在一个需要低延时响应的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客户端访问超时的多个因素及参数的更多相关文章

  1. Java客户端访问HBase集群解决方案(优化)

    测试环境:Idea+Windows10 准备工作: <1>.打开本地 C:\Windows\System32\drivers\etc(系统默认)下名为hosts的系统文件,如果提示当前用户 ...

  2. java request判断微信客户端访问

    微信客户端访问时候user-agent信息如下: Mozilla/5.0 (Linux; Android 5.0.1; M040 Build/LRX22C) AppleWebKit/537.36 (K ...

  3. restTemplate设置访问超时

    (一)RestTemplate 客户端 1.RestTemplate 是Spring的封装,需要spring的包 spring-web-3.0.7.RELEASE.jar 2.客户端代码: /** * ...

  4. .net core 下使用StackExchange的Redis库访问超时解决

    原文:.net core 下使用StackExchange的Redis库访问超时解决 目录 问题:并发稍微多的情况下Redis偶尔返回超时 给出了参考网址? 结论 小备注 引用链接 问题:并发稍微多的 ...

  5. Linux服务器可以ping,但是telnet端口超时,网站wget超时,访问超时的解决办法

    最近无法通过SSH连接Linux服务器,访问该服务器上的HTTP服务也出现异常.可以ping,但是telnet端口超时,网站wget超时,访问超时. 最后排查是内核配置问题 原来是 net.ipv4. ...

  6. [原创]用windows7连接windows2003的终端服务器时,出现"由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断"的问题

    用windows7连接windows2003的终端服务器时,出现"由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断"的问题,原因是终端服务器授权方式设置为了"每 ...

  7. Windows Azure Virtual Network (10) 使用Azure Access Control List(ACL)设置客户端访问权限

    <Windows Azure Platform 系列文章目录> 本文介绍的是国内由世纪互联运维的China Azure. 我们在创建完Windows Azure Virtual Machi ...

  8. Spring之在客户端访问RESTful业务

    Spring之在客户端访问RESTful业务 RestTemplate 是客户端访问RESTful业务的核心类.在概念上与Spring其他的模板类相似,比如JdbcTemplate和JmsTempla ...

  9. C#完全无客户端访问Oracle

    网上太多的C#无客户端访问oracle案例,经我测试无一成功,特将我在oracle官网上和自己琢磨总结,终于成功,废话不多说,直接上项目. 一,准备条件 (由于我这里是用的控制台程序来测试的,所以将上 ...

随机推荐

  1. Python版本切换和Pip安装

    Python版本切换 现在常用的linux系统中都会默认携带python运行环境,在ubuntu 16.04 和centos 7.3中携带有Python 2.7 和Python3.5两个版本, 默认使 ...

  2. Java进阶知识点:服务端高并发的基石 - NIO与Reactor AIO与Proactor

    一.背景 要提升服务器的并发处理能力,通常有两大方向的思路. 1.系统架构层面.比如负载均衡.多级缓存.单元化部署等等. 2.单节点优化层面.比如修复代码级别的性能Bug.JVM参数调优.IO优化等等 ...

  3. C++字符串拼接和输入

    一 .char类型字符串以空字符结尾 1.以空字符结尾,空字符被写作\0,其ASCII码为0,用来标记字符串的结尾. char dog[4]={'a','b','c','d'}   //不是一个字符串 ...

  4. Windows下PATH等环境变量详解(转载)

    本文转载自http://legend2011.blog.51cto.com/3018495/553255 在学习JAVA的过程中,涉及到多个环境变量(environment variable)的概念, ...

  5. Tengine/Nginx 安装

    原文出处:http://my.oschina.net/liuhuan0927/blog/604663 一.Tengine是什么 简介 Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基 ...

  6. H5页面 绝对定位元素被 软键盘弹出时顶起

    H5页面 绝对定位元素被 软键盘弹出时顶起 在h5页面开发的过程中,我们可能会遇到下面这个问题,当页面中有输入框的时候,系统自带的软盘会把按钮挤出原来的位置.那么我们该怎么解决呢?下面列出一下的方法: ...

  7. 对Objective-C中runtime的理解

    Objective-C是面向runtime(运行时)的语言,在应用程序运行的时候来决定函数内部实现什么以及做出其它决定的语言.程序员可以在程序运行时创建,检 查,修改类,对象和它们的方法,Object ...

  8. Martin Fowler关于IOC和DI的文章(原版)

    Inversion of Control Containers and the Dependency Injection pattern In the Java community there's b ...

  9. lintcode-156-合并区间

    156-合并区间 给出若干闭合区间,合并所有重叠的部分. 样例 给出的区间列表 => 合并后的区间列表: [ [ [1, 3], [1, 6], [2, 6], => [8, 10], [ ...

  10. <Android>日期,时间选择对话框

    a)         调用Activity的onCreateDialog()方法创建对话框 b)        分别在OnDateSetListener的onDateSet()方法和OnTimeSet ...