我的hbase客户端连接过多
为了获得最大吞吐量,我使用批处理和增量将数据放入hbase, 代码示例:我的hbase客户端连接过多,hbase,hbase-client,Hbase,Hbase Client,为了获得最大吞吐量,我使用批处理和增量将数据放入hbase, 代码示例: Configuration configuration = HBaseConfiguration.create(); configuration.set("hbase.zookeeper.quorum", "10.2.1.12:2181"); configuration.set("hbase.zookeeper.znode.parent", "/hbase"); Connection connection = Connec
Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.zookeeper.quorum", "10.2.1.12:2181");
configuration.set("hbase.zookeeper.znode.parent", "/hbase");
Connection connection = ConnectionFactory.createConnection(configuration);
Table table = null;
try {
table = connection.getTable(TableName.valueOf("test"));
Object[] results = new Object[incrementList.size()];
table.batch(incrementList, results);
for (Object result : results) {
if (null == result) {
failed++;
} else {
//System.out.println("Batch operation result: " + result);
}
}
System.out.println("Batch operation failed: " + failed);
} catch (Exception ex) {
throw new RPCCallException("Hbase put error: " + ex.getMessage(), ex);
} finally {
table.close();
}
connection.close();
共有233个H连接。
和线程堆栈:
hbase客户端版本:
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.3.0</version>
</dependency>
org.apache.hbase
hbase客户端
1.3.0
我发现了问题,hbase连接的线程池默认配置为:core=max=256,因此线程数将增加到256