2。hbase CRUD--Caching VS Batch

本文详细解析了HBase中扫描机制的工作原理,包括如何通过设置caching和batch参数来控制扫描过程中RPC调用的数量,以及这些参数如何影响数据检索的速度和效率。了解这些配置对于优化HBase应用的性能至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1

in case of ONE region,a table with 10 rows and two familys(each contains 10 cols),if a Scan is set by caching and batch below will spawn appitiate rpcs:

 
in generate ,a additional rpc is generated when invoke next in clientscanner to determine whether scan is done in this region.

   so there is a approx relationship :

caching=row num(precisely,batch num per rpc)
batch=batch size/cols num
results=batch num(result num,one result maybe contains many cols)
rpcs=loop

   actually,if u dive into src,u will see that is indeed true.

   but why this batch is used for ?

   as hbase is a 'big table' (ie. Millions rows x Millions cols).withou this limit,if there too many cols or too large data existed in certain cols,it will result in huge data to be returned in one wave,so explicit performance will dro p down.

 

2

  3

below,the rectangle contains less than or equals to 3 cells is as ONE row,so the 'caching' is as 'row level' to limit data to returned,and the batch is to 'column level' to limit this.

that says ,both caching (wide granularity) and batch(narrow granularity) to control the data retuned to clinet.



 look at the HRegion.java,u will see this fragment:

byte [] nextRow;
          do {
            this.storeHeap.next(results, limit - results.size(), metric);
            if (limit > 0 && results.size() == limit) {
              if (this.filter != null && filter.hasFilterRow()) {
                throw new IncompatibleFilterException(
                  "Filter with filterRow(List<KeyValue>) incompatible with scan with limit!");
              }
              return true; // we are expecting more yes, but also limited to how many we can return.
            }
          } while (Bytes.equals(currentRow, nextRow = peekRow()));

 that means if the last time to scan is same as last row,it will continue to retrieve the Batch size columns.

 

Ref:

definitive guide

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值