HBase 缓存

hbase缓存 分了两层:memstore,blockcache

memstore 供写使用,写请求先写入memstore,regionserver会给每个region提供一个memstore,当memstore满64MB后,会启动flush,将数据刷新到磁盘,当memstore的总大小超过限制时(heapsize * hbase.regionserver.global.memstore.upperLimit*0.9),会强行启动flush进程,从最大的memstore开始flush知道低于限制。

blochcache 主要供给读使用,读请求先读memstore中查数据,查不到在blockcache中查数据,再查不到,就在磁盘上读数据,并把读到的数据放入blockcache。由于blochcache是一个LRU,因此blockcache达到上限后会启动淘汰机制,淘汰最老的一批数据。

 

一个regionserver中有一个blockcache和N个memstore,它们的大小总和不能大于heapsize * 0.8 否则HBase不能启动,默认blockcache为0.2,memstore为0.4,注重读取响应时间的系统应该将blochcache设置大一些,加大缓存命中率。

原文地址:https://www.cnblogs.com/zhxdxf/p/8275306.html