In an HBase cluster that requires a low latency response, using HBase's default client timeout configuration is simply a disaster.
But we can consider adding the following parameters to the client to change the situation:
1. Hbase.rpc.timeout:RPC timeout, the default 60s, can be modified to (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, can be configured to 1
4. Hbase.client.pause:Sleep time again, the default is 1s, can be reduced, such as 100ms (the 1.1 version of HBase has become 100ms, please control the HBA you use SE version)
5. Zookeeper.recovery.retry:The number of retries ZK, Can be adjusted to 3 times, ZK was not easy-to-hang, and if HBase cl Uster problem, each retry retry the operation of ZK'll be, the total number of retry ZK Is:hbase.client.retries.number * Zookeeper.recovery.retry, and sleep time each retry'll has exponential growth of 2, every time you access the HBase W Ill try again, in a HBase operation if it involves multiple ZK access, if ZK was not available, there would be many times th E 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. (in version 1.1, this parameter is named 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 class
Sleep time Point-of-magnitude growth
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;
}
Multiple factors and parameters for HBase Client Access timeout