Skip to content
Snippets Groups Projects
Commit 55164dc4 authored by Sean Busbey's avatar Sean Busbey
Browse files

Merge pull request #274 from takebayashi/hbase-writebuffersize

[hbase] Make write buffer size of HBase client configurable
parents 9c1c40fa 15634b9b
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ public class HBaseClient extends com.yahoo.ycsb.DB
public String _columnFamily="";
public byte _columnFamilyBytes[];
public boolean _clientSideBuffering = false;
public long _writeBufferSize = 1024 * 1024 * 12;
public static final int Ok=0;
public static final int ServerError=-1;
......@@ -85,6 +86,10 @@ public class HBaseClient extends com.yahoo.ycsb.DB
{
_clientSideBuffering = Boolean.parseBoolean(getProperties().getProperty("clientbuffering"));
}
if (getProperties().containsKey("writebuffersize"))
{
_writeBufferSize = Long.parseLong(getProperties().getProperty("writebuffersize"));
}
_columnFamily = getProperties().getProperty("columnfamily");
if (_columnFamily == null)
......@@ -123,7 +128,7 @@ public class HBaseClient extends com.yahoo.ycsb.DB
_hTable = new HTable(config, table);
//2 suggestions from http://ryantwopointoh.blogspot.com/2009/01/performance-of-hbase-importing.html
_hTable.setAutoFlush(!_clientSideBuffering, true);
_hTable.setWriteBufferSize(1024*1024*12);
_hTable.setWriteBufferSize(_writeBufferSize);
//return hTable;
}
......
......@@ -89,6 +89,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
* insert/update/delete latencies, client side buffering should be disabled.
*/
public boolean _clientSideBuffering = false;
public long _writeBufferSize = 1024 * 1024 * 12;
public static final int Ok=0;
public static final int ServerError=-1;
......@@ -105,6 +106,9 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
if ("true".equals(getProperties().getProperty("clientbuffering", "false"))) {
this._clientSideBuffering = true;
}
if (getProperties().containsKey("writebuffersize")) {
_writeBufferSize = Long.parseLong(getProperties().getProperty("writebuffersize"));
}
if (getProperties().getProperty("durability") != null) {
this._durability = Durability.valueOf(getProperties().getProperty("durability"));
......@@ -166,7 +170,7 @@ public class HBaseClient10 extends com.yahoo.ycsb.DB
//suggestions from http://ryantwopointoh.blogspot.com/2009/01/performance-of-hbase-importing.html
if (_clientSideBuffering) {
final BufferedMutatorParams p = new BufferedMutatorParams(tableName);
p.writeBufferSize(1024*1024*12);
p.writeBufferSize(_writeBufferSize);
this._bufferedMutator = this._connection.getBufferedMutator(p);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment