Index: src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java (revision 1151610) +++ src/main/java/org/apache/hadoop/hbase/client/HTableInterface.java (working copy) @@ -190,8 +190,9 @@ * until the internal buffer is full. *

* This can be used for group commit, or for submitting user defined - * batches, but sending large lists of values is not recommended. That may - * produce performance problems. + * batches. The writeBuffer will be periodically inspected while the List + * is processed, so depending on the List size the writeBuffer may flush + * not at all, or more than once. * @param puts The list of mutations to apply. The batch put is done by * aggregating the iteration of the Puts over the write buffer * at the client-side for a single RPC call. Index: src/main/java/org/apache/hadoop/hbase/client/HTable.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HTable.java (revision 1151610) +++ src/main/java/org/apache/hadoop/hbase/client/HTable.java (working copy) @@ -113,7 +113,8 @@ private long maxScannerResultSize; private boolean closed; private int operationTimeout; - + private static final int DOPUT_WB_CHECK = 10; // i.e., doPut checks the writebuffer every X Puts. + /** * Creates an object to access a HBase table. * Internally it creates a new instance of {@link Configuration} and a new @@ -706,10 +707,20 @@ } private void doPut(final List puts) throws IOException { + int n = 0; for (Put put : puts) { validatePut(put); writeBuffer.add(put); currentWriteBufferSize += put.heapSize(); + + // we need to periodically see if the writebuffer is full instead of waiting until the end of the List + n++; + if (n == DOPUT_WB_CHECK) { + if (autoFlush || currentWriteBufferSize > writeBufferSize) { + flushCommits(); + n = 0; + } + } } if (autoFlush || currentWriteBufferSize > writeBufferSize) { flushCommits();