HBASE-18374 RegionServer Metrics improvements
This commit is contained in:
parent
df90ba58db
commit
95808b4672
|
@ -53,6 +53,12 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
|
||||||
*/
|
*/
|
||||||
void updatePut(long t);
|
void updatePut(long t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the PutBatch time histogram if a batch contains a Put op
|
||||||
|
* @param t
|
||||||
|
*/
|
||||||
|
void updatePutBatch(long t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the Delete time histogram
|
* Update the Delete time histogram
|
||||||
*
|
*
|
||||||
|
@ -60,6 +66,24 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
|
||||||
*/
|
*/
|
||||||
void updateDelete(long t);
|
void updateDelete(long t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Delete time histogram if a batch contains a delete op
|
||||||
|
* @param t time it took
|
||||||
|
*/
|
||||||
|
void updateDeleteBatch(long t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update checkAndDelete histogram
|
||||||
|
* @param t time it took
|
||||||
|
*/
|
||||||
|
void updateCheckAndDelete(long t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update checkAndPut histogram
|
||||||
|
* @param t time it took
|
||||||
|
*/
|
||||||
|
void updateCheckAndPut(long t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the Get time histogram .
|
* Update the Get time histogram .
|
||||||
*
|
*
|
||||||
|
@ -334,25 +358,29 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
|
||||||
String UPDATES_BLOCKED_DESC =
|
String UPDATES_BLOCKED_DESC =
|
||||||
"Number of MS updates have been blocked so that the memstore can be flushed.";
|
"Number of MS updates have been blocked so that the memstore can be flushed.";
|
||||||
String DELETE_KEY = "delete";
|
String DELETE_KEY = "delete";
|
||||||
|
String CHECK_AND_DELETE_KEY = "checkAndDelete";
|
||||||
|
String CHECK_AND_PUT_KEY = "checkAndPut";
|
||||||
|
String DELETE_BATCH_KEY = "deleteBatch";
|
||||||
String GET_SIZE_KEY = "getSize";
|
String GET_SIZE_KEY = "getSize";
|
||||||
String GET_KEY = "get";
|
String GET_KEY = "get";
|
||||||
String INCREMENT_KEY = "increment";
|
String INCREMENT_KEY = "increment";
|
||||||
String MUTATE_KEY = "mutate";
|
String PUT_KEY = "put";
|
||||||
|
String PUT_BATCH_KEY = "putBatch";
|
||||||
String APPEND_KEY = "append";
|
String APPEND_KEY = "append";
|
||||||
String REPLAY_KEY = "replay";
|
String REPLAY_KEY = "replay";
|
||||||
String SCAN_KEY = "scan";
|
String SCAN_KEY = "scan";
|
||||||
String SCAN_SIZE_KEY = "scanSize";
|
String SCAN_SIZE_KEY = "scanSize";
|
||||||
String SCAN_TIME_KEY = "scanTime";
|
String SCAN_TIME_KEY = "scanTime";
|
||||||
|
|
||||||
String SLOW_MUTATE_KEY = "slowPutCount";
|
String SLOW_PUT_KEY = "slowPutCount";
|
||||||
String SLOW_GET_KEY = "slowGetCount";
|
String SLOW_GET_KEY = "slowGetCount";
|
||||||
String SLOW_DELETE_KEY = "slowDeleteCount";
|
String SLOW_DELETE_KEY = "slowDeleteCount";
|
||||||
String SLOW_INCREMENT_KEY = "slowIncrementCount";
|
String SLOW_INCREMENT_KEY = "slowIncrementCount";
|
||||||
String SLOW_APPEND_KEY = "slowAppendCount";
|
String SLOW_APPEND_KEY = "slowAppendCount";
|
||||||
String SLOW_MUTATE_DESC =
|
String SLOW_PUT_DESC =
|
||||||
"The number of Multis that took over 1000ms to complete";
|
"The number of batches containing puts that took over 1000ms to complete";
|
||||||
String SLOW_DELETE_DESC =
|
String SLOW_DELETE_DESC =
|
||||||
"The number of Deletes that took over 1000ms to complete";
|
"The number of batches containing delete(s) that took over 1000ms to complete";
|
||||||
String SLOW_GET_DESC = "The number of Gets that took over 1000ms to complete";
|
String SLOW_GET_DESC = "The number of Gets that took over 1000ms to complete";
|
||||||
String SLOW_INCREMENT_DESC =
|
String SLOW_INCREMENT_DESC =
|
||||||
"The number of Increments that took over 1000ms to complete";
|
"The number of Increments that took over 1000ms to complete";
|
||||||
|
|
|
@ -37,7 +37,11 @@ public class MetricsRegionServerSourceImpl
|
||||||
|
|
||||||
final MetricsRegionServerWrapper rsWrap;
|
final MetricsRegionServerWrapper rsWrap;
|
||||||
private final MetricHistogram putHisto;
|
private final MetricHistogram putHisto;
|
||||||
|
private final MetricHistogram putBatchHisto;
|
||||||
private final MetricHistogram deleteHisto;
|
private final MetricHistogram deleteHisto;
|
||||||
|
private final MetricHistogram deleteBatchHisto;
|
||||||
|
private final MetricHistogram checkAndDeleteHisto;
|
||||||
|
private final MetricHistogram checkAndPutHisto;
|
||||||
private final MetricHistogram getHisto;
|
private final MetricHistogram getHisto;
|
||||||
private final MetricHistogram incrementHisto;
|
private final MetricHistogram incrementHisto;
|
||||||
private final MetricHistogram appendHisto;
|
private final MetricHistogram appendHisto;
|
||||||
|
@ -97,12 +101,17 @@ public class MetricsRegionServerSourceImpl
|
||||||
super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
|
super(metricsName, metricsDescription, metricsContext, metricsJmxContext);
|
||||||
this.rsWrap = rsWrap;
|
this.rsWrap = rsWrap;
|
||||||
|
|
||||||
putHisto = getMetricsRegistry().newTimeHistogram(MUTATE_KEY);
|
putHisto = getMetricsRegistry().newTimeHistogram(PUT_KEY);
|
||||||
slowPut = getMetricsRegistry().newCounter(SLOW_MUTATE_KEY, SLOW_MUTATE_DESC, 0L);
|
putBatchHisto = getMetricsRegistry().newTimeHistogram(PUT_BATCH_KEY);
|
||||||
|
slowPut = getMetricsRegistry().newCounter(SLOW_PUT_KEY, SLOW_PUT_DESC, 0L);
|
||||||
|
|
||||||
deleteHisto = getMetricsRegistry().newTimeHistogram(DELETE_KEY);
|
deleteHisto = getMetricsRegistry().newTimeHistogram(DELETE_KEY);
|
||||||
slowDelete = getMetricsRegistry().newCounter(SLOW_DELETE_KEY, SLOW_DELETE_DESC, 0L);
|
slowDelete = getMetricsRegistry().newCounter(SLOW_DELETE_KEY, SLOW_DELETE_DESC, 0L);
|
||||||
|
|
||||||
|
deleteBatchHisto = getMetricsRegistry().newTimeHistogram(DELETE_BATCH_KEY);
|
||||||
|
checkAndDeleteHisto = getMetricsRegistry().newTimeHistogram(CHECK_AND_DELETE_KEY);
|
||||||
|
checkAndPutHisto = getMetricsRegistry().newTimeHistogram(CHECK_AND_PUT_KEY);
|
||||||
|
|
||||||
getHisto = getMetricsRegistry().newTimeHistogram(GET_KEY);
|
getHisto = getMetricsRegistry().newTimeHistogram(GET_KEY);
|
||||||
slowGet = getMetricsRegistry().newCounter(SLOW_GET_KEY, SLOW_GET_DESC, 0L);
|
slowGet = getMetricsRegistry().newCounter(SLOW_GET_KEY, SLOW_GET_DESC, 0L);
|
||||||
|
|
||||||
|
@ -537,4 +546,24 @@ public class MetricsRegionServerSourceImpl
|
||||||
public void updatePauseTimeWithoutGc(long t) {
|
public void updatePauseTimeWithoutGc(long t) {
|
||||||
pausesWithoutGc.add(t);
|
pausesWithoutGc.add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeleteBatch(long t) {
|
||||||
|
deleteBatchHisto.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCheckAndDelete(long t) {
|
||||||
|
checkAndDeleteHisto.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCheckAndPut(long t) {
|
||||||
|
checkAndPutHisto.add(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updatePutBatch(long t) {
|
||||||
|
putBatchHisto.add(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
|
||||||
|
|
||||||
String suffix = "Count";
|
String suffix = "Count";
|
||||||
|
|
||||||
regionPutKey = regionNamePrefix + MetricsRegionServerSource.MUTATE_KEY + suffix;
|
regionPutKey = regionNamePrefix + MetricsRegionServerSource.PUT_KEY + suffix;
|
||||||
regionPut = registry.getCounter(regionPutKey, 0L);
|
regionPut = registry.getCounter(regionPutKey, 0L);
|
||||||
|
|
||||||
regionDeleteKey = regionNamePrefix + MetricsRegionServerSource.DELETE_KEY + suffix;
|
regionDeleteKey = regionNamePrefix + MetricsRegionServerSource.DELETE_KEY + suffix;
|
||||||
|
|
|
@ -71,18 +71,34 @@ public class MetricsRegionServer {
|
||||||
return regionServerWrapper;
|
return regionServerWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePut(long t) {
|
public void updatePutBatch(long t) {
|
||||||
if (t > 1000) {
|
if (t > 1000) {
|
||||||
serverSource.incrSlowPut();
|
serverSource.incrSlowPut();
|
||||||
}
|
}
|
||||||
|
serverSource.updatePutBatch(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePut(long t) {
|
||||||
serverSource.updatePut(t);
|
serverSource.updatePut(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDelete(long t) {
|
public void updateDelete(long t) {
|
||||||
|
serverSource.updateDelete(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateDeleteBatch(long t) {
|
||||||
if (t > 1000) {
|
if (t > 1000) {
|
||||||
serverSource.incrSlowDelete();
|
serverSource.incrSlowDelete();
|
||||||
}
|
}
|
||||||
serverSource.updateDelete(t);
|
serverSource.updateDeleteBatch(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateCheckAndDelete(long t) {
|
||||||
|
serverSource.updateCheckAndDelete(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateCheckAndPut(long t) {
|
||||||
|
serverSource.updateCheckAndPut(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGet(long t) {
|
public void updateGet(long t) {
|
||||||
|
|
|
@ -1029,10 +1029,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
if (regionServer.metricsRegionServer != null) {
|
if (regionServer.metricsRegionServer != null) {
|
||||||
long after = EnvironmentEdgeManager.currentTime();
|
long after = EnvironmentEdgeManager.currentTime();
|
||||||
if (batchContainsPuts) {
|
if (batchContainsPuts) {
|
||||||
regionServer.metricsRegionServer.updatePut(after - before);
|
regionServer.metricsRegionServer.updatePutBatch(after - before);
|
||||||
}
|
}
|
||||||
if (batchContainsDelete) {
|
if (batchContainsDelete) {
|
||||||
regionServer.metricsRegionServer.updateDelete(after - before);
|
regionServer.metricsRegionServer.updateDeleteBatch(after - before);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1104,10 +1104,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
if (regionServer.metricsRegionServer != null) {
|
if (regionServer.metricsRegionServer != null) {
|
||||||
long after = EnvironmentEdgeManager.currentTime();
|
long after = EnvironmentEdgeManager.currentTime();
|
||||||
if (batchContainsPuts) {
|
if (batchContainsPuts) {
|
||||||
regionServer.metricsRegionServer.updatePut(after - before);
|
regionServer.metricsRegionServer.updatePutBatch(after - before);
|
||||||
}
|
}
|
||||||
if (batchContainsDelete) {
|
if (batchContainsDelete) {
|
||||||
regionServer.metricsRegionServer.updateDelete(after - before);
|
regionServer.metricsRegionServer.updateDeleteBatch(after - before);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2681,6 +2681,8 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
OperationQuota quota = null;
|
OperationQuota quota = null;
|
||||||
RpcCallContext context = RpcServer.getCurrentCall();
|
RpcCallContext context = RpcServer.getCurrentCall();
|
||||||
ActivePolicyEnforcement spaceQuotaEnforcement = null;
|
ActivePolicyEnforcement spaceQuotaEnforcement = null;
|
||||||
|
MutationType type = null;
|
||||||
|
long before = EnvironmentEdgeManager.currentTime();
|
||||||
// Clear scanner so we are not holding on to reference across call.
|
// Clear scanner so we are not holding on to reference across call.
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
controller.setCellScanner(null);
|
controller.setCellScanner(null);
|
||||||
|
@ -2698,7 +2700,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
|
long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;
|
||||||
Result r = null;
|
Result r = null;
|
||||||
Boolean processed = null;
|
Boolean processed = null;
|
||||||
MutationType type = mutation.getMutateType();
|
type = mutation.getMutateType();
|
||||||
|
|
||||||
quota = getRpcQuotaManager().checkQuota(region, OperationQuota.OperationType.MUTATE);
|
quota = getRpcQuotaManager().checkQuota(region, OperationQuota.OperationType.MUTATE);
|
||||||
spaceQuotaEnforcement = getSpaceQuotaManager().getActiveEnforcements();
|
spaceQuotaEnforcement = getSpaceQuotaManager().getActiveEnforcements();
|
||||||
|
@ -2795,6 +2797,29 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
if (quota != null) {
|
if (quota != null) {
|
||||||
quota.close();
|
quota.close();
|
||||||
}
|
}
|
||||||
|
// Update metrics
|
||||||
|
if (regionServer.metricsRegionServer != null && type != null) {
|
||||||
|
long after = EnvironmentEdgeManager.currentTime();
|
||||||
|
switch (type) {
|
||||||
|
case DELETE:
|
||||||
|
if (request.hasCondition()) {
|
||||||
|
regionServer.metricsRegionServer.updateCheckAndDelete(after - before);
|
||||||
|
} else {
|
||||||
|
regionServer.metricsRegionServer.updateDelete(after - before);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PUT:
|
||||||
|
if (request.hasCondition()) {
|
||||||
|
regionServer.metricsRegionServer.updateCheckAndPut(after - before);
|
||||||
|
} else {
|
||||||
|
regionServer.metricsRegionServer.updatePut(after - before);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,8 @@ public class TestMetricsRegionServer {
|
||||||
rsm.updateAppend(1002);
|
rsm.updateAppend(1002);
|
||||||
}
|
}
|
||||||
for (int i=0; i < 13; i ++) {
|
for (int i=0; i < 13; i ++) {
|
||||||
rsm.updateDelete(13);
|
rsm.updateDeleteBatch(13);
|
||||||
rsm.updateDelete(1003);
|
rsm.updateDeleteBatch(1003);
|
||||||
}
|
}
|
||||||
for (int i=0; i < 14; i ++) {
|
for (int i=0; i < 14; i ++) {
|
||||||
rsm.updateGet(14);
|
rsm.updateGet(14);
|
||||||
|
@ -123,15 +123,26 @@ public class TestMetricsRegionServer {
|
||||||
rsm.updateIncrement(1005);
|
rsm.updateIncrement(1005);
|
||||||
}
|
}
|
||||||
for (int i=0; i < 16; i ++) {
|
for (int i=0; i < 16; i ++) {
|
||||||
rsm.updatePut(16);
|
rsm.updatePutBatch(16);
|
||||||
rsm.updatePut(1006);
|
rsm.updatePutBatch(1006);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i < 17; i ++) {
|
||||||
|
rsm.updatePut(17);
|
||||||
|
rsm.updateDelete(17);
|
||||||
|
rsm.updateCheckAndDelete(17);
|
||||||
|
rsm.updateCheckAndPut(17);
|
||||||
}
|
}
|
||||||
|
|
||||||
HELPER.assertCounter("appendNumOps", 24, serverSource);
|
HELPER.assertCounter("appendNumOps", 24, serverSource);
|
||||||
HELPER.assertCounter("deleteNumOps", 26, serverSource);
|
HELPER.assertCounter("deleteBatchNumOps", 26, serverSource);
|
||||||
HELPER.assertCounter("getNumOps", 28, serverSource);
|
HELPER.assertCounter("getNumOps", 28, serverSource);
|
||||||
HELPER.assertCounter("incrementNumOps", 30, serverSource);
|
HELPER.assertCounter("incrementNumOps", 30, serverSource);
|
||||||
HELPER.assertCounter("mutateNumOps", 32, serverSource);
|
HELPER.assertCounter("putBatchNumOps", 32, serverSource);
|
||||||
|
HELPER.assertCounter("putNumOps", 17, serverSource);
|
||||||
|
HELPER.assertCounter("deleteNumOps", 17, serverSource);
|
||||||
|
HELPER.assertCounter("checkAndDeleteNumOps", 17, serverSource);
|
||||||
|
HELPER.assertCounter("checkAndPutNumOps", 17, serverSource);
|
||||||
|
|
||||||
|
|
||||||
HELPER.assertCounter("slowAppendCount", 12, serverSource);
|
HELPER.assertCounter("slowAppendCount", 12, serverSource);
|
||||||
|
|
|
@ -260,7 +260,7 @@ public class TestRegionServerMetrics {
|
||||||
assertCounter("writeRequestCount", writeRequests + 30);
|
assertCounter("writeRequestCount", writeRequests + 30);
|
||||||
|
|
||||||
assertRegionMetrics("getCount", 10);
|
assertRegionMetrics("getCount", 10);
|
||||||
assertRegionMetrics("mutateCount", 31);
|
assertRegionMetrics("putCount", 31);
|
||||||
|
|
||||||
doNGets(10, true); // true = batch
|
doNGets(10, true); // true = batch
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class TestRemoveRegionMetrics {
|
||||||
"_region_" + regionInfo.getEncodedName()+
|
"_region_" + regionInfo.getEncodedName()+
|
||||||
"_metric";
|
"_metric";
|
||||||
|
|
||||||
metricsHelper.assertCounter(prefix + "_mutateCount", 1, currentAgg);
|
metricsHelper.assertCounter(prefix + "_putCount", 1, currentAgg);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -129,7 +129,7 @@ public class TestRemoveRegionMetrics {
|
||||||
.getMetrics()
|
.getMetrics()
|
||||||
.getSource()
|
.getSource()
|
||||||
.getAggregateSource();
|
.getAggregateSource();
|
||||||
metricsHelper.assertCounter(prefix + "_mutateCount", 0, destAgg);
|
metricsHelper.assertCounter(prefix + "_putCount", 0, destAgg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue