HBASE-24994 Add hedgedReadOpsInCurThread metric (#2365)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Javier Akira Luca de Tena 2020-09-09 10:45:46 +09:00 committed by GitHub
parent 2250b51fe7
commit 2e638de6a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 0 deletions

View File

@ -486,6 +486,9 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String HEDGED_READ_WINS = "hedgedReadWins"; String HEDGED_READ_WINS = "hedgedReadWins";
String HEDGED_READ_WINS_DESC = String HEDGED_READ_WINS_DESC =
"The number of times we started a hedged read and a hedged read won"; "The number of times we started a hedged read and a hedged read won";
String HEDGED_READ_IN_CUR_THREAD = "hedgedReadOpsInCurThread";
String HEDGED_READ_IN_CUR_THREAD_DESC =
"The number of times we execute a hedged read in current thread as a fallback for task rejection";
String TOTAL_BYTES_READ = "totalBytesRead"; String TOTAL_BYTES_READ = "totalBytesRead";
String TOTAL_BYTES_READ_DESC = "The total number of bytes read from HDFS"; String TOTAL_BYTES_READ_DESC = "The total number of bytes read from HDFS";

View File

@ -458,6 +458,8 @@ public class MetricsRegionServerSourceImpl
.addCounter(Interns.info(HEDGED_READS, HEDGED_READS_DESC), rsWrap.getHedgedReadOps()) .addCounter(Interns.info(HEDGED_READS, HEDGED_READS_DESC), rsWrap.getHedgedReadOps())
.addCounter(Interns.info(HEDGED_READ_WINS, HEDGED_READ_WINS_DESC), .addCounter(Interns.info(HEDGED_READ_WINS, HEDGED_READ_WINS_DESC),
rsWrap.getHedgedReadWins()) rsWrap.getHedgedReadWins())
.addCounter(Interns.info(HEDGED_READ_IN_CUR_THREAD, HEDGED_READ_IN_CUR_THREAD_DESC),
rsWrap.getHedgedReadOpsInCurThread())
.addCounter(Interns.info(BLOCKED_REQUESTS_COUNT, BLOCKED_REQUESTS_COUNT_DESC), .addCounter(Interns.info(BLOCKED_REQUESTS_COUNT, BLOCKED_REQUESTS_COUNT_DESC),
rsWrap.getBlockedRequestsCount()) rsWrap.getBlockedRequestsCount())
.tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC), .tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC),

View File

@ -452,6 +452,11 @@ public interface MetricsRegionServerWrapper {
*/ */
long getHedgedReadWins(); long getHedgedReadWins();
/**
* @return Count of times a hedged read executes in current thread
*/
long getHedgedReadOpsInCurThread();
/** /**
* @return Number of total bytes read from HDFS. * @return Number of total bytes read from HDFS.
*/ */

View File

@ -928,6 +928,11 @@ class MetricsRegionServerWrapperImpl
return this.dfsHedgedReadMetrics == null? 0: this.dfsHedgedReadMetrics.getHedgedReadWins(); return this.dfsHedgedReadMetrics == null? 0: this.dfsHedgedReadMetrics.getHedgedReadWins();
} }
@Override
public long getHedgedReadOpsInCurThread() {
return this.dfsHedgedReadMetrics == null ? 0 : this.dfsHedgedReadMetrics.getHedgedReadOpsInCurThread();
}
@Override @Override
public long getTotalBytesRead() { public long getTotalBytesRead() {
return FSDataInputStreamWrapper.getTotalBytesRead(); return FSDataInputStreamWrapper.getTotalBytesRead();

View File

@ -420,6 +420,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
return 10; return 10;
} }
@Override
public long getHedgedReadOpsInCurThread() {
return 5;
}
@Override @Override
public long getTotalBytesRead() { public long getTotalBytesRead() {
return 0; return 0;

View File

@ -801,6 +801,8 @@ See <<hbase_metrics>> for more information.
This could indicate that read requests are often slow, or that hedged reads are triggered too quickly. This could indicate that read requests are often slow, or that hedged reads are triggered too quickly.
* hedgeReadOpsWin - the number of times the hedged read thread was faster than the original thread. * hedgeReadOpsWin - the number of times the hedged read thread was faster than the original thread.
This could indicate that a given RegionServer is having trouble servicing requests. This could indicate that a given RegionServer is having trouble servicing requests.
* hedgedReadOpsInCurThread - the number of times hedged read was rejected from executor and needed to fallback to be executed in current thread.
This could indicate that current hedged read thread pool size is not appropriate.
[[perf.deleting]] [[perf.deleting]]