HBase客户端访问超时的多个因素及参数

简介: 在一个需要低延时响应的hbase集群中,使用hbase默认的客户端超时配置简直就是灾难。但是我们可以考虑在客户端上加上如下几个参数,去改变这种状况:1. hbase.

在一个需要低延时响应的hbase集群中,使用hbase默认的客户端超时配置简直就是灾难。

但是我们可以考虑在客户端上加上如下几个参数,去改变这种状况:

1. hbase.rpc.timeout: RPC timeout, The default 60s, 可以修改为5000(5s)

2. ipc.socket.timeout: Socket link timeout, should be less than or equal to RPC timeout, the default is 20s

3. hbase.client.retries.number: The number of retries, default is 14, 可以配置为1

4. hbase.client.pause: Sleep time again, the default is 1s, can be reduced, such as 100ms(在1.1版本的hbase已经变为100ms,请对照你使用的hbase版本)

5. zookeeper.recovery.retry: The number of retries ZK, Can be adjusted to 3 times, ZK is not easy to hang, And if HBase cluster problem, Each retry retry the operation of ZK will be, The total number of retry ZK is: hbase.client.retries.number * zookeeper.recovery.retry, And sleep time each retry will have exponential growth of 2, Every time you access the HBase will try again, In a HBase operation if it involves multiple ZK access, If ZK is not available, There will be many times the ZK retry, Is a waste of time.

6. zookeeper.recovery.retry.intervalmill: Sleep time ZK retries, the default is 1s, can be reduced, for example: 200ms

7. hbase.regionserver.lease.period: A scan query when interacting with server timeout, the default is 60s.(在1.1版本,该参数名为hbase.client.scanner.timeout.period)

 

Retry interval strategy RPC:

public static long getPauseTime(final long pause, final int tries) {

int ntries = tries;

// RETRY_BACKOFF[] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32, 64 }

    if (ntries >= HConstants.RETRY_BACKOFF.length) {

      ntries = HConstants.RETRY_BACKOFF.length - 1;

    }

    long normalPause = pause * HConstants.RETRY_BACKOFF[ntries];

    long jitter =  (long)(normalPause * RANDOM.nextFloat() * 0.01f); // 1% possible jitter

    return normalPause + jitter;

  }

 

 

Retry interval strategy ZK:

// RetryCounter类

//Sleep time 指数级增长

public void sleepUntilNextRetry() throws InterruptedException {

    int attempts = getAttemptTimes();

    long sleepTime = (long) (retryIntervalMillis * Math.pow(2, attempts));

    timeUnit.sleep(sleepTime);

       }

      

// retriesRemaining, The default value ismaxReties, Each retry after reduction1

       public int getAttemptTimes() {

          return maxRetries-retriesRemaining+1;

       }

 

相关实践学习
云数据库HBase版使用教程
  相关的阿里云产品:云数据库 HBase 版 面向大数据领域的一站式NoSQL服务,100%兼容开源HBase并深度扩展,支持海量数据下的实时存储、高并发吞吐、轻SQL分析、全文检索、时序时空查询等能力,是风控、推荐、广告、物联网、车联网、Feeds流、数据大屏等场景首选数据库,是为淘宝、支付宝、菜鸟等众多阿里核心业务提供关键支撑的数据库。 了解产品详情: https://cn.aliyun.com/product/hbase   ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
4天前
|
分布式计算 分布式数据库 API
Spark与HBase的集成与数据访问
Spark与HBase的集成与数据访问
|
4天前
|
存储 分布式计算 Hadoop
HBase的数据访问是如何进行的?
HBase的数据访问是如何进行的?
30 0
|
Go 分布式数据库 Hbase
|
算法 Java 大数据
访问HBase经常出现报错:ServerNotRunningYetException: Server xxx.xxx.xxx is not running yet
访问HBase经常出现报错:ServerNotRunningYetException: Server xxx.xxx.xxx is not running yet
|
XML 弹性计算 Shell
HBase Shell 访问|学习笔记
快速学习 HBase Shell 访问
137 0
|
分布式计算 Java Hadoop
HBase集群搭建记录 | 云计算[CentOS8] | Maven项目访问HBase(下)
step3. 使用eclipse打开maven项目并配置 step4. 项目访问HBase
180 0
HBase集群搭建记录 | 云计算[CentOS8] | Maven项目访问HBase(下)
|
Java Linux 分布式数据库
HBase集群搭建记录 | 云计算[CentOS7] | Maven项目访问HBase(上)
写在前面 step1 Maven的下载与配置 1. 下载解压 2. 环境变量设置 3. 查看安装 4. 设置阿里云镜像[加速jar包下载] step2 Maven项目的创建 1.创建项目 2. 编译项目 3.测试项目 4.打包项目 5.安装项目
156 0
HBase集群搭建记录 | 云计算[CentOS7] | Maven项目访问HBase(上)
|
SQL 分布式计算 Java
Hbase入门(五)——客户端(Java,Shell,Thrift,Rest,MR,WebUI)
Hbase的客户端有原生java客户端,Hbase Shell,Thrift,Rest,Mapreduce,WebUI等等。 下面是这几种客户端的常见用法。
1536 0
Hbase入门(五)——客户端(Java,Shell,Thrift,Rest,MR,WebUI)
|
运维 Java 分布式数据库
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(二)
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(二)
318 0
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(二)
|
存储 SQL 缓存
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(一)
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(一)
215 0
硬吃一个P0故障,「在线业务」应该如何调优HBase参数?(一)