HBASE-17017 Remove the current per-region latency histogram metrics

This commit is contained in:
Enis Soztutar 2016-11-08 15:43:41 -08:00
parent a70f73c1e1
commit 123d26ed90
7 changed files with 25 additions and 72 deletions

View File

@ -317,7 +317,7 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String BLOCK_CACHE_GENERAL_BLOOM_META_HIT_COUNT = "blockCacheGeneralBloomMetaHitCount"; String BLOCK_CACHE_GENERAL_BLOOM_META_HIT_COUNT = "blockCacheGeneralBloomMetaHitCount";
String BLOCK_CACHE_DELETE_FAMILY_BLOOM_HIT_COUNT = "blockCacheDeleteFamilyBloomHitCount"; String BLOCK_CACHE_DELETE_FAMILY_BLOOM_HIT_COUNT = "blockCacheDeleteFamilyBloomHitCount";
String BLOCK_CACHE_TRAILER_HIT_COUNT = "blockCacheTrailerHitCount"; String BLOCK_CACHE_TRAILER_HIT_COUNT = "blockCacheTrailerHitCount";
String RS_START_TIME_NAME = "regionServerStartTime"; String RS_START_TIME_NAME = "regionServerStartTime";
String ZOOKEEPER_QUORUM_NAME = "zookeeperQuorum"; String ZOOKEEPER_QUORUM_NAME = "zookeeperQuorum";
String SERVER_NAME_NAME = "serverName"; String SERVER_NAME_NAME = "serverName";
@ -336,6 +336,7 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String MUTATE_KEY = "mutate"; String MUTATE_KEY = "mutate";
String APPEND_KEY = "append"; String APPEND_KEY = "append";
String REPLAY_KEY = "replay"; String REPLAY_KEY = "replay";
String SCAN_KEY = "scan";
String SCAN_SIZE_KEY = "scanSize"; String SCAN_SIZE_KEY = "scanSize";
String SCAN_TIME_KEY = "scanTime"; String SCAN_TIME_KEY = "scanTime";
@ -447,6 +448,6 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String RPC_MUTATE_REQUEST_COUNT_DESC = String RPC_MUTATE_REQUEST_COUNT_DESC =
"Number of rpc mutation requests this region server has answered."; "Number of rpc mutation requests this region server has answered.";
String AVERAGE_REGION_SIZE = "averageRegionSize"; String AVERAGE_REGION_SIZE = "averageRegionSize";
String AVERAGE_REGION_SIZE_DESC = String AVERAGE_REGION_SIZE_DESC =
"Average region size over the region server including memstore and storefile sizes."; "Average region size over the region server including memstore and storefile sizes.";
} }

View File

@ -59,24 +59,12 @@ public interface MetricsRegionSource extends Comparable<MetricsRegionSource> {
*/ */
void updateDelete(); void updateDelete();
/**
* Update count and sizes of gets.
* @param getSize size in bytes of the resulting key values for a get
*/
void updateGetSize(long getSize);
/** /**
* Update time of gets * Update time of gets
* @param mills time for this get operation. * @param mills time for this get operation.
*/ */
void updateGet(long mills); void updateGet(long mills);
/**
* Update the count and sizes of resultScanner.next()
* @param scanSize Size in bytes of the resulting key values for a next()
*/
void updateScanSize(long scanSize);
/** /**
* Update time used of resultScanner.next(). * Update time used of resultScanner.next().
* */ * */

View File

@ -24,7 +24,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.metrics.Interns; import org.apache.hadoop.hbase.metrics.Interns;
import org.apache.hadoop.metrics2.MetricHistogram;
import org.apache.hadoop.metrics2.MetricsRecordBuilder; import org.apache.hadoop.metrics2.MetricsRecordBuilder;
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableFastCounter; import org.apache.hadoop.metrics2.lib.MutableFastCounter;
@ -48,21 +47,22 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
private final String regionNamePrefix; private final String regionNamePrefix;
private final String regionPutKey; private final String regionPutKey;
private final String regionDeleteKey; private final String regionDeleteKey;
private final String regionGetSizeKey;
private final String regionGetKey; private final String regionGetKey;
private final String regionIncrementKey; private final String regionIncrementKey;
private final String regionAppendKey; private final String regionAppendKey;
private final String regionScanSizeKey; private final String regionScanKey;
private final String regionScanTimeKey;
/*
* Implementation note: Do not put histograms per region. With hundreds of regions in a server
* histograms allocate too many counters. See HBASE-17016.
*/
private final MutableFastCounter regionPut; private final MutableFastCounter regionPut;
private final MutableFastCounter regionDelete; private final MutableFastCounter regionDelete;
private final MutableFastCounter regionIncrement; private final MutableFastCounter regionIncrement;
private final MutableFastCounter regionAppend; private final MutableFastCounter regionAppend;
private final MetricHistogram regionGetSize; private final MutableFastCounter regionGet;
private final MetricHistogram regionGet; private final MutableFastCounter regionScan;
private final MetricHistogram regionScanSize;
private final MetricHistogram regionScanTime;
private final int hashCode; private final int hashCode;
public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper, public MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
@ -95,17 +95,11 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix; regionAppendKey = regionNamePrefix + MetricsRegionServerSource.APPEND_KEY + suffix;
regionAppend = registry.getCounter(regionAppendKey, 0L); regionAppend = registry.getCounter(regionAppendKey, 0L);
regionGetSizeKey = regionNamePrefix + MetricsRegionServerSource.GET_SIZE_KEY; regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY + suffix;
regionGetSize = registry.newSizeHistogram(regionGetSizeKey); regionGet = registry.getCounter(regionGetKey, 0L);
regionGetKey = regionNamePrefix + MetricsRegionServerSource.GET_KEY; regionScanKey = regionNamePrefix + MetricsRegionServerSource.SCAN_KEY + suffix;
regionGet = registry.newTimeHistogram(regionGetKey); regionScan = registry.getCounter(regionScanKey, 0L);
regionScanSizeKey = regionNamePrefix + MetricsRegionServerSource.SCAN_SIZE_KEY;
regionScanSize = registry.newSizeHistogram(regionScanSizeKey);
regionScanTimeKey = regionNamePrefix + MetricsRegionServerSource.SCAN_TIME_KEY;
regionScanTime = registry.newTimeHistogram(regionScanTimeKey);
hashCode = regionWrapper.getRegionHashCode(); hashCode = regionWrapper.getRegionHashCode();
} }
@ -134,14 +128,8 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
registry.removeMetric(regionDeleteKey); registry.removeMetric(regionDeleteKey);
registry.removeMetric(regionIncrementKey); registry.removeMetric(regionIncrementKey);
registry.removeMetric(regionAppendKey); registry.removeMetric(regionAppendKey);
registry.removeMetric(regionGetSizeKey);
registry.removeMetric(regionGetKey); registry.removeMetric(regionGetKey);
registry.removeMetric(regionScanSizeKey); registry.removeMetric(regionScanKey);
registry.removeMetric(regionScanTimeKey);
registry.removeHistogramMetrics(regionGetSizeKey);
registry.removeHistogramMetrics(regionGetKey);
registry.removeHistogramMetrics(regionScanSizeKey);
registry.removeHistogramMetrics(regionScanTimeKey);
regionWrapper = null; regionWrapper = null;
} }
@ -157,24 +145,14 @@ public class MetricsRegionSourceImpl implements MetricsRegionSource {
regionDelete.incr(); regionDelete.incr();
} }
@Override
public void updateGetSize(long getSize) {
regionGetSize.add(getSize);
}
@Override @Override
public void updateGet(long mills) { public void updateGet(long mills) {
regionGet.add(mills); regionGet.incr();
}
@Override
public void updateScanSize(long scanSize) {
regionScanSize.add(scanSize);
} }
@Override @Override
public void updateScanTime(long mills) { public void updateScanTime(long mills) {
regionScanTime.add(mills); regionScan.incr();
} }
@Override @Override

View File

@ -258,7 +258,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
*/ */
protected volatile long lastReplayedOpenRegionSeqId = -1L; protected volatile long lastReplayedOpenRegionSeqId = -1L;
protected volatile long lastReplayedCompactionSeqId = -1L; protected volatile long lastReplayedCompactionSeqId = -1L;
// collects Map(s) of Store to sequence Id when handleFileNotFound() is involved // collects Map(s) of Store to sequence Id when handleFileNotFound() is involved
protected List<Map> storeSeqIds = new ArrayList<>(); protected List<Map> storeSeqIds = new ArrayList<>();
@ -7085,11 +7085,6 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
void metricsUpdateForGet(List<Cell> results, long before) { void metricsUpdateForGet(List<Cell> results, long before) {
if (this.metricsRegion != null) { if (this.metricsRegion != null) {
long totalSize = 0L;
for (Cell cell : results) {
totalSize += CellUtil.estimatedSerializedSizeOf(cell);
}
this.metricsRegion.updateGetSize(totalSize);
this.metricsRegion.updateGet(EnvironmentEdgeManager.currentTime() - before); this.metricsRegion.updateGet(EnvironmentEdgeManager.currentTime() - before);
} }

View File

@ -49,18 +49,10 @@ public class MetricsRegion {
source.updateDelete(); source.updateDelete();
} }
public void updateGetSize(final long getSize) {
source.updateGetSize(getSize);
}
public void updateGet(final long t) { public void updateGet(final long t) {
source.updateGet(t); source.updateGet(t);
} }
public void updateScanSize(final long scanSize) {
source.updateScanSize(scanSize);
}
public void updateScanTime(final long t) { public void updateScanTime(final long t) {
source.updateScanTime(t); source.updateScanTime(t);
} }

View File

@ -2718,7 +2718,6 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
region.updateReadRequestsCount(i); region.updateReadRequestsCount(i);
long end = EnvironmentEdgeManager.currentTime(); long end = EnvironmentEdgeManager.currentTime();
long responseCellSize = context != null ? context.getResponseCellSize() : 0; long responseCellSize = context != null ? context.getResponseCellSize() : 0;
region.getMetrics().updateScanSize(responseCellSize);
region.getMetrics().updateScanTime(end - before); region.getMetrics().updateScanTime(end - before);
if (regionServer.metricsRegionServer != null) { if (regionServer.metricsRegionServer != null) {
regionServer.metricsRegionServer.updateScanSize(responseCellSize); regionServer.metricsRegionServer.updateScanSize(responseCellSize);

View File

@ -157,7 +157,7 @@ public class TestRegionServerMetrics {
"_table_"+tableNameString + "_table_"+tableNameString +
"_region_" + i.getEncodedName()+ "_region_" + i.getEncodedName()+
"_metric"; "_metric";
metricsHelper.assertCounter(prefix + "_getNumOps", 10, agg); metricsHelper.assertCounter(prefix + "_getCount", 10, agg);
metricsHelper.assertCounter(prefix + "_mutateCount", 31, agg); metricsHelper.assertCounter(prefix + "_mutateCount", 31, agg);
} }
} }
@ -229,8 +229,8 @@ public class TestRegionServerMetrics {
"_table_"+tableNameString + "_table_"+tableNameString +
"_region_" + i.getEncodedName()+ "_region_" + i.getEncodedName()+
"_metric"; "_metric";
metricsHelper.assertCounter(prefix + "_getSizeNumOps", 10, agg); metricsHelper.assertCounter(prefix + "_getCount", 10, agg);
metricsHelper.assertCounter(prefix + "_getNumOps", 10, agg); metricsHelper.assertCounter(prefix + "_getCount", 10, agg);
} }
metricsHelper.assertCounterGt("Get_num_ops", 10, serverSource); metricsHelper.assertCounterGt("Get_num_ops", 10, serverSource);
} }
@ -446,7 +446,7 @@ public class TestRegionServerMetrics {
"_table_"+tableNameString + "_table_"+tableNameString +
"_region_" + i.getEncodedName()+ "_region_" + i.getEncodedName()+
"_metric"; "_metric";
metricsHelper.assertCounter(prefix + "_scanSizeNumOps", NUM_SCAN_NEXT, agg); metricsHelper.assertCounter(prefix + "_scanCount", NUM_SCAN_NEXT, agg);
} }
metricsHelper.assertCounterGt("ScanSize_num_ops", numScanNext, serverSource); metricsHelper.assertCounterGt("ScanSize_num_ops", numScanNext, serverSource);
} }
@ -496,7 +496,7 @@ public class TestRegionServerMetrics {
"_table_"+tableNameString + "_table_"+tableNameString +
"_region_" + i.getEncodedName()+ "_region_" + i.getEncodedName()+
"_metric"; "_metric";
metricsHelper.assertCounter(prefix + "_scanTimeNumOps", NUM_SCAN_NEXT, agg); metricsHelper.assertCounter(prefix + "_scanCount", NUM_SCAN_NEXT, agg);
} }
metricsHelper.assertCounterGt("ScanTime_num_ops", numScanNext, serverSource); metricsHelper.assertCounterGt("ScanTime_num_ops", numScanNext, serverSource);
} }
@ -548,7 +548,7 @@ public class TestRegionServerMetrics {
"_table_"+tableNameString + "_table_"+tableNameString +
"_region_" + i.getEncodedName()+ "_region_" + i.getEncodedName()+
"_metric"; "_metric";
metricsHelper.assertCounter(prefix + "_scanSizeNumOps", NUM_SCAN_NEXT, agg); metricsHelper.assertCounter(prefix + "_scanCount", NUM_SCAN_NEXT, agg);
} }
metricsHelper.assertCounterGt("ScanSize_num_ops", numScanNext, serverSource); metricsHelper.assertCounterGt("ScanSize_num_ops", numScanNext, serverSource);
} }