Hbase性能优化
Hbase优化
Region 相关参数:
hbase.hregion.max.filesize=50G
默认 10G,Region 中任意 HStore 所有文件大小总和大于该值就会进行分裂。
建议生产设置为 50G左右。
BlockCache 相关参数:
hbase.bucketcache.ioengine=offheap
hfile.block.cache.size=0.2
hbase.bucketcache.size=10240
堆外存大小
HBase刷写参数:
hbase.hregion.memstore.flush.size=256M
触发MemStore 的刷写阈值
hbase.hregion.memstore.block.multiplier=8
默认值 4,Region 中所有 MemStore 超过单个 MemStore 大小的倍数达到该参数值时, 就会阻塞写请求并强制 Flush。
hbase.regionserver.global.memstore.size=0.6
写缓存的总比例
hbase.regionserver.optionalcacheflushinterval=36000000
默认3600000 即一个小时)进行 MemStore 的刷写, 建议设置较大值
Compaction相关参数:
hbase.hstore.compaction.min=10
默认值 3,一个 Store 中 HFile 文件数量超过该阈值就会触发一次 Minor Compaction。
hbase.hstore.compaction.max=15
一次 Minor Compaction 最多合并的 HFile 文件数量
hbase.regionserver.thread.compaction.small=5
hbase.regionserver.thread.compaction.large=5
默认值 1,表示 large compactions 与 small compactions 线程池的大小
hbase.hstore.blockingStoreFiles=100
默认值 10,表示一个 Store 中 HFile 文件数量达到该值就会阻塞写入,等待 Compaction 的完成。一般建议调大点,比如设置为 100,避免出现阻塞更新的情况
hbase.hregion.majorcompaction=0
关闭自动触发Major Compaction,在业务低峰期时手动执行。
HLog 相关参数:
hbase.regionserver.maxlogs=200
wal 日志文件总数超过该阈值就会强制执行 flush 操作
hbase.regionserver.hlog.splitlog.writer.threads=10
默认为 3,重新写入 hdfs 的线程数
Call Queue 相关参数:
hbase.regionserver.handler.count=200
服务器端用来处理用户请求的线程数
其他:
hbase.online.schema.update.enable=true
在线更新schema
hbase.zookeeper.useMulti= true
开启 zookeeper 的 multi-update 功能
开启MSLAB:
hbase.hregion.memstore.mslab.enabled=true
HBase2.0版本建议设置:
hbase.hregion.compacting.memstore.type=BASIC