Configuring HBase Garbage Collection

Garbage collection (memory cleanup) by the JVM can cause HBase clients to experience excessive latency. See Tuning Java Garbage Collection for HBase for a discussion of various garbage collection settings and their impacts on performance.

To tune the garbage collection settings, you pass the relevant parameters to the JVM.

Example configuration values are not recommendations and should not be considered as such. This is not the complete list of configuration options related to garbage collection. See the documentation for your JVM for details on these settings.

-XX:+UseG1GC
Use the 'G1' garbage collection algorithm. Cloudera considers this setting to be experimental.
-XX:MaxGCPauseMillis=value
The garbage collection pause time. Set this to the maximum amount of latency your cluster can tolerate while allowing as much garbage collection as possible.
-XX:+ParallelRefProcEnabled
Enable or disable parallel reference processing by using a + or - symbol before the parameter name.
-XX:-ResizePLAB
Enable or disable resizing of Promotion Local Allocation Buffers (PLABs) by using a + or - symbol before the parameter name.
-XX:ParallelGCThreads=value
The number of parallel garbage collection threads to run concurrently.
-XX:G1NewSizePercent=value
The percent of the heap to be used for garbage collection. If the value is too low, garbage collection is ineffective. If the value is too high, not enough heap is available for other uses by HBase.

If your cluster is managed by Cloudera Manager, follow the instructions in Configure HBase Garbage Collection Using Cloudera Manager. Otherwise, use Configure HBase Garbage Collection Using the Command Line.

Configure HBase Garbage Collection Using Cloudera Manager

Minimum Required Role: Full Administrator

  1. Go to the HBase service.
  2. Click the Configuration tab.
  3. Select Scope > RegionServer.
  4. Select Category > Advanced.
  5. Locate the Java Configuration Options for HBase RegionServer property or search for it by typing its name in the Search box.
  6. Add or modify JVM configuration options.
  7. Click Save Changes to commit the changes.
  8. Restart the role.

Configure HBase Garbage Collection Using the Command Line

  1. On each RegionServer, edit conf/hbase-env.sh.
  2. Add or modify JVM configuration options on the line beginning with HBASE_OPTS.
  3. Restart the RegionServer.

Disabling the BoundedByteBufferPool

HBase uses a BoundedByteBufferPool to avoid fragmenting the heap. The G1 garbage collector reduces the need to avoid fragmenting the heap in some cases. If you use the G1 garbage collector, you can disable the BoundedByteBufferPool in HBase in CDH 5.7 and higher. This can reduce the number of "old generation" items that need to be collected. This configuration is experimental.

To disable the BoundedByteBufferPool, set the hbase.ipc.server.reservoir.enabled property to false.

Disable the BoundedByteBufferPool Using Cloudera Manager

  1. Go to the HBase service.
  2. Click the Configuration tab.
  3. Select Scope > RegionServer.
  4. Select Category > Advanced.
  5. Locate the HBase Service Advanced Configuration Snippet (Safety Valve) for hbase-site.xml property, or search for it by typing its name in the Search box.
  6. Add the following XML:
    <property>
      <name>hbase.ipc.server.reservoir.enabled</name>
      <value>false</value>
    </property>
  7. Click Save Changes to commit the changes.
  8. Restart the service.

Disable the BoundedByteBufferPool Using the Command Line

  1. On each RegionServer, edit conf/hbase-site.xml.
  2. Add the following XML:
    <property>
      <name>hbase.ipc.server.reservoir.enabled</name>
      <value>false</value>
    </property>
  3. Save your changes.
  4. Restart the RegionServer.