Configure the off-heap BucketCache using the command line
You can configure the off-heap BucketCache engine from the command-line interface.
-
Configure the MaxDirectMemorySize option for the RegionServers JVMS. Add the
JVM option
$HBASE_REGIONSERVER_OPTS -XX:MaxDirectMemorySize=<size>G
, replacing<size>
with a value not smaller than the aggregated heap size expressed as a number of gigabytes + the off-heap BucketCache, expressed as a number of gigabytes + around 1GB used for HDFS short circuit read. For example, if the off-heap BucketCache is 16GB and the heap size is 15GB, the total value of MaxDirectMemorySize could be 32:-XX:MaxDirectMamorySize=32G
. This can be done adding the following line inhbase-env.sh
:HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:MaxDirectMemorySize=<size>G"
-
In the
hbase-site.xml
files on the RegionServers, configure the properties in BucketCache configuration properties as appropriate, using the example below as a model.<property> <name>hbase.bucketcache.combinedcache.enabled</name> <value>true</value> </property> <property> <name>hbase.bucketcache.ioengine</name> <value>offheap</value> </property> <property> <name>hbase.bucketcache.size</name> <value>8388608</value> </property> <property> <name>hfile.block.cache.size</name> <value>0.2</value> </property> <property> <name>hbase.regionserver.global.memstore.size</name> <value>0.6</value> </property>
Optionally, when combined BucketCache is in use, you can decrease the heap size ratio allocated to the L1 BlockCache, and increase the Memstore size as it is done in the above example. The on-heap BlockCache only stores indexes and Bloom filters, the actual data resides in the off-heap BucketCache. A larger Memstore is able to accommodate more write request before flushing them to disks.- Decrease
hfile.block.cache.size
to0.3
or0.2
. - Increase
hbase.regionserver.global.memstore.size
to0.5
or0.6
respectively.
- Decrease
- Restart each RegionServer for the changes to take effect.