【问题标题】:Too many hconnections of my hbase client我的 hbase 客户端的 hconnections 太多
【发布时间】:2017-11-05 04:01:27
【问题描述】:

为了获得最大的throughoutput,我使用批量puts和increments将数据放入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-client 版本:

<dependency>
  <groupId>org.apache.hbase</groupId>
  <artifactId>hbase-client</artifactId>
  <version>1.3.0</version>
</dependency>

【问题讨论】:

    标签: hbase hbase-client


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2011-09-03
      • 1970-01-01
      • 1970-01-01
      • 2020-07-17
      • 2019-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多