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 theserver(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