HBase-client-0.98.4客户端重要参数分析

本文深入分析了HBase客户端的几个重要参数,包括hbase.client.operation.timeout、hbase.rpc.timeout、hbase.client.pause和hbase.client.retries.number,并详细解释了这些参数如何影响单个操作(如get、append、increment、delete、put)及批量操作的重试机制。通过源码解析,展示了如何计算重试等待时间,查找分区信息以及如何处理超时和重试操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

重要参数

参见: org.apache.hadoop.hbase.HConstants

hbase.rpc.timeout:表示一次RPC请求的超时时间
默认值:
public static int DEFAULT_HBASE_RPC_TIMEOUT = 60000;
hbase.client.operation.timeout:该值与hbase.rpc.timeout的区别为,hbase.rpc.timeout为一次rpc调用的超时时间。而hbase.client.operation.timeout为一次操作总的时间(从开始调用到重试n次之后失败的总时间)
默认值:
public static final int DEFAULT_HBASE_CLIENT_OPERATION_TIMEOUT = Integer.MAX_VALUE;
hbase.client.pause:失败重试时等待时间,随着重试次数越多,重试等待时间越长
默认值:
public static long DEFAULT_HBASE_CLIENT_PAUSE = 100;
hbase.client.retries.number:失败时重试次数
默认值:
public static int DEFAULT_HBASE_CLIENT_RETRIES_NUMBER = 31;
hbase.client.scanner.timeout.period:HBase客户端2次scan操作间隔时间
默认值:
public static int DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD = 60000;

源代码分析

参见:org.apache.hadoop.hbase.client.HTable

可见hbase.client.operation.timeoutget、append、increment、delete、put 等操作相关

具体分析

rpcCallerFactory.<Result> newCaller().callWithRetries(callable, this.operationTimeout)

源码如下

 /**
   * Retries if invocation fails.
   * @param callTimeout Timeout for this call
   * @param callable The {@link RetryingCallable} to run.
   * @return an object of type T
   * @throws IOException if a remote or network exception occurs
   * @throws RuntimeException other unspecified error
   */
  @edu.umd.cs.findbugs.annotations.SuppressWarnings
      (value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "na")
  public synchronized T callWithRetries(RetryingCallable<T> callable, int callTimeout)
  throws IOException, RuntimeException {
    this.callTimeout = callTimeout;
    List<RetriesExhaustedException.ThrowableWithExtraContext> exceptions =
      new ArrayList<RetriesExhaustedException.ThrowableWithExtraContext>();
    this.globalStartTime = EnvironmentEdgeManager.currentTimeMillis();
    for (int tries = 0;; tries++) {
      long expectedSleep = 0;
      try {
        beforeCall();
        callable.prepare(tries != 0); /
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值