HBase performance tuning
This article contains some advice on how to improve the performance of your HBase cluster. Some of the approaches cannot be defined exactly for all cases and need to be fine-tailored to each certain configuration.
HDFS settings
Parameter | Default and description | Recommendation |
---|---|---|
dfs.datanode.max.transfer.threads |
Default: This parameter defines the upper limit of files that an HDFS DataNode can service simultaneously |
Set the value to This parameter has to be added manually in the Custom hdfs-site.xml section of the HDFS service configuration page |
HBase settings
Parameter | Default and description | Recommendation |
---|---|---|
zookeeper.session.timeout |
Default: This parameter defines the timeout before the Master server considers a RegionServer inactive. The default value is irrelevant if the ZooKeeper service retains its default value for the tick time (2 seconds). The ZooKeeper service has its own timeouts for inactive services: minimum 2 tick times and maximum 20 tick times. By default, this means that the ZooKeeper service will wait no longer than 40 seconds before removing the inactive RegionServer ethereal znode while the Master server would be still waiting |
Lower the HBase timeout parameter or increase the ZooKeeper tick time parameter — whichever is lower takes effect. Mind the following:
The |
hbase.regionserver.handler.count |
Default: This parameter defines the number of open threads for responses to the user tables incoming queries |
Each thread consumes CPU time and RAM, so you need to assess the average query payload size before tweaking this parameter. If the queries carry high payload, then this parameter is better kept at a low value. But if the queries are mostly light, then increasing this parameter value might be a good idea: begin with the number of the CPU cores doubled, and then increase it little by little until you reach the peak performance. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.master.wait.on.regionservers.mintostart |
Default: This parameter defines the minimum number of RegionServers that have to be registered with the Master server before it begins to assign regions to them. The default value of |
If your cluster has many regions (e.g. several thousands), it is recommended to increase this parameter value so that the assignment of the regions would be delayed and hence more evenly distributed. Otherwise, the first registered RegionServer may constitute a bottleneck and slow down the cluster startup and even lead to the loss of access to itself. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
HBASE_MASTER_OPTS |
Default: This parameter defines the amount of RAM allocated to the Master server |
The default value is enough for most cases, as Master server does not require a lot of RAM to work. Nevertheless, if your cluster is really big and has an enormous number of tables and/or regions, you may need to increase the upper memory limit, since the Master server retains the regions statuses in its memory. This parameter is located in the hbase-env.sh section of the HBase service configuration page |
HBASE_REGIONSERVER_OPTS |
Default: This parameter defines the size of the RegionServer heap memory, which contains the MemStores and the block cache |
Generally, the more this parameter value is the better. Use the following considerations:
This parameter is located in the hbase-regionserver-env.sh section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hfile.block.cache.size |
Default: This parameter defines the share of the block cache in the RegionServer heap memory |
The default value is good for a situation when the table data is often heavily read and it is more or less the same data all the time. If the situation is not exactly that (e.g. the requested data is different all the time, or the data requisition is rather light in an average request), you may want to reduce this parameter value down to This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.regionserver.global.memstore.size |
Default: This parameter defines the share of the MemStore in the RegionServer heap memory |
Specify a value so that it combined with the This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.regionserver.global.memstore.size.lower.limit |
Default: This parameter defines a threshold percentage in MemStores of a region. When the MemStores of a region are filled with new data up to this threshold, updates are blocked and flushes are forced |
Leave the default value as is |
hbase.hregion.memstore.flush.size |
Default: This parameter defines the size of data in a MemStore when it is flushed and an HFile is created from its contents. When a MemStore is flushed, all the other MemStores in the same region are flushed too. The less this value is, the more often flushes occur, the bigger is the I/O overhead, the larger is the number of HFiles, and the more often the comaction processes are run |
It is recommended to double this parameter value (up to This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page. Possible values are |
hbase.hstore.flusher.count |
Default: This parameter defines the number of threads for the flush operations. The more this value is, the more effective the flush process is, but at the same time the more the load on the HDFS is, and potentially the bigger is the number of compactions |
You can start with increasing this parameter value up to This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hregion.memstore.block.multiplier |
Default: This parameter defines the multiplier of possible MemStore size (defined by the |
It is recommended to increase this value up to This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.regionserver.regionSplitLimit |
Default: This parameter defines the maximum number of regions on a RegionServer after which region splitting can no longer occur. This is not a limit on the number of the regions itself, but rather a stopping point in creating more regions |
The default value of
To find the number of regions, you need to multiply the region server heap memory size by the MemStore share quotient in it (the first two parameters), and then consecutively divide the result by the This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hregion.max.filesize |
Default: This parameter defines the maximum total size of HFiles in a region before it is split |
The default value is generally good. You can increase this value based on performance (for example, up to 20 GB), but not too much: much higher values can negatively affect the compaction process. This parameter is located in the hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.hstore.compactionThreshold |
Default: This parameter defines the number of HFiles in a region before they undergo a minor compaction |
It is recommended to up this value to This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hstore.blockingStoreFiles |
Default: This parameter defines the maximum number of HFiles in a region before the updates to this region are blocked. The block remains until a minor compaction is forcefully run or the timeout specified by the |
If your cluster has a heavy write load and flushes are delayed due to too many HFiles, increase this parameter value. This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hstore.blockingWaitTime |
Default: This parameter defines the timeout for the updates block of a region due to too many HFiles (see the previous parameter). When this time passes, the block is lifted regardless of whether the minor compaction has completed |
Adjust this parameter according to the requirements of your cluster. This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hstore.compaction.min |
Default: This parameter defines the minimum number of HFiles designated for compaction before such compaction can be executed |
It is recommended to increase this value to This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hstore.compaction.max |
Default: This parameter defines the maximum number of HFiles that can participate in a single compaction operation |
The default value is good for most cases. If your cluster has a heavy write load, increase this value. This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.regionserver.thread.compaction.small |
Default: This parameter defines the number of threads used for the minor compaction process |
If your cluster has a heavy write load and minor compactions are executed too often and take too much time, increase this value. However, it should not exceed half the number of disks available for the HBase. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.regionserver.thread.compaction.large |
Default: This parameter defines the number of threads used for the major compaction process |
If your cluster has a heavy write load, you can increase this value, but making it higher than the This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.hstore.compaction.min.size |
Default: This parameter defines the maximum HFile size for it to be automatically designated for compaction |
If your cluster has a heavy write load, you may have many small HFiles that, when compacted, form an HFile with a size still under this value (especially in case of a low This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.hstore.compaction.ratio |
Default: This parameter defines a quotient for the previous parameter ( |
The higher this value is, the more often the compaction occurs, but less HFiles need to be read, and vice versa. Lower value is preferrable for clusters with heavy write load, and higher value is preferrable for clusters with heavy read load. Usually the default value is good; if you choose to adjust it — it is recommended to stay within the This parameter is located in the hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.regionserver.logroll.multiplier |
Default: This parameter defines the size of a WAL file relative to the HDFS block size (which is specified by the |
It is recommended to leave this parameter as is in all cases. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.regionserver.maxlogs |
Default: This parameter defines the maximum number of WAL files in a region server |
You need to calculate the value for this parameter yourself by doing the following:
If your cluster has a heavy write load, when the number of WAL files reaches its limit, region servers might require to flush all MemStores until all WAL files are archived and there is enough space for writing operations. This is called flush storm, and can be recognized by the following line in the log: INFO[regionserver//10.22.100.5:16020.logRoller] wal.FSHLog:Too many wals: logs=35, maxlogs=32; forcing flush of 20 regions(s): d4kjnfnkf34335666d03cb1f If this happens, increase the parameter value. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.hregion.memstore.mslab.chunksize |
Default: This parameter defines the size of a chunk in the MemStore Allocation Buffer |
Double or quadruple this parameter value if you use large-sized records. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Parameter | Default and description | Recommendation |
---|---|---|
hbase.client.write.buffer |
Default: This parameter defines the size of the write buffer. The bigger this value is, the more memory is used on both server and client sides, but the less the number of RPCs is |
It is recommended to set this value to This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.client.pause |
Default: This parameter defines the duration of the client pause. It is used as a timeout before retrying a failed operation |
It is recommended to significantly reduce this value (e.g. down to This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.client.retries.number |
Default: This parameter defines the maximum number of retries of a failed operation |
It is recommended to reduce this value to This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.rpc.timeout |
Default: This parameter defines the timeout for all RPCs that the client sends to the HBase |
If your client requests tend to take heavy toll on RAM, increase this parameter value. Avoid increasing it too much, because the client might wait for too long and then fail anyway. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.client.scanner.timeout.period |
Default: This parameter defines the timeout for the RPCs related to scanning operations |
This parameter value becomes useless if it is set higher than the This parameter is located in the hbase-site.xml section of the HBase service configuration page |
hbase.client.scanner.caching |
Default: This parameter defines the maximum number of rows that the client scanner can fetch from the HBase in one sitting |
If the value is too high, the scanner may become overloaded by fetching and transferring too much data to the client, or even exceed the timeout, failing the job; also this will lead to using too much heap memory even in case of success. A value too low will lead to ineffective use of cluster resources, causing idling. This parameter value must be chosen carefully according to the characteristics of disks, RAM, CPUs, and the average read load. This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
hbase.client.scanner.max.result.size |
Default: This parameter defines the maximum number of bytes returned when calling a next scanner method. If a single row size is larger than this value, it is still returned in its entirety |
The default value is good for 1G Ethernet networks. If the network capacity in your cluster is better, increase this value, but mind the following:
This parameter has to be added manually in the Custom hbase-site.xml section of the HBase service configuration page |
Other
Rowkey design
It is recommended to use salting/hashing techniques for even row distribution in regions.
Major compaction equalization
For more smooth performance, consider scheduling major comactions for different tables and column families using cron
or similar utilities.
Compression
In some cases, using compression can boost performance by downsizing the HFiles and hence lowering the number of I/O operations.
Bloom filters
It is recommeded to use the Bloom filters for boosting the search operations in HFiles. The Bloom filters allow detecting whether an HFile contains a certain key by reading only a small amount of data of that HFile. If it does not, then the next HFile is searched.
Bulk load
Use bulk load whenever possible, as it is the fastest way to upload data to the HBase. If bulk load is not possible, consider uniting singular requests (like GET
, PUT
, or DELETE
) in lists, as they are quite costly when executed one by one.