我的 hbase 客户端 hconnections 太多

问题描述 投票:0回答:2

为了获得最大的吞吐量,我使用批量放入和增量将数据放入hbase, 代码示例:

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>
hbase hbase-client
2个回答
4
投票

我发现问题了,hbase连接的线程池默认配置是:core = max = 256,所以线程数会增加到256


0
投票

或者您可以调整

hbase.hconnection.threads.max
的值。

© www.soinside.com 2019 - 2024. All rights reserved.