Client-side Write Buffer 使用table.setAutoFlush(false)

p152 Hbase权威指南


The HBase API comes with a built in client-side write buffer that

collects put operations so that they are sent in one RPC call to the
server(s). The global switch to control if it is used or not is
represented by the following methods:
void setAutoFlush(boolean autoFlush)

boolean isAutoFlush()


By default the client-side buffer is not enabled. You activate the buffer
by setting auto flush to false, by invoking:
table.setAutoFlush(false)
This will enable the client-side buffering mechanism and you can
check the state of the flag respectively with the isAutoFlush()
method. It will return true when you initially create the HTable
instance. Otherwise it will obviously return the current state as set by
your code.
Once you have activated the buffer you can store data into HBase as
shown in the the section called “Single Puts” above. You do not cause
any RPCs to occur though, because the Put instances you stored are
kept in memory in your client process. When you want to force the
data to be written you can call another API function:
void flushCommits() throws IOException

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值