HBASE-21414 : StoreFileSize growth rate metric

Signed-off-by: Sergey Shelukhin <sershe@apache.org>
This commit is contained in:
Tommy Li 2018-12-06 13:43:13 -08:00 committed by Sergey Shelukhin
parent 12e75a8a63
commit 170df27b88
6 changed files with 31 additions and 6 deletions

View File

@ -234,6 +234,7 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String MEMSTORE_SIZE = "memStoreSize";
String MEMSTORE_SIZE_DESC = "Size of the memstore";
String STOREFILE_SIZE = "storeFileSize";
String STOREFILE_SIZE_GROWTH_RATE = "storeFileSizeGrowthRate";
String MAX_STORE_FILE_AGE = "maxStoreFileAge";
String MIN_STORE_FILE_AGE = "minStoreFileAge";
String AVG_STORE_FILE_AGE = "avgStoreFileAge";
@ -243,6 +244,8 @@ public interface MetricsRegionServerSource extends BaseSource, JvmPauseMonitorSo
String AVG_STORE_FILE_AGE_DESC = "Average age of store files hosted on this RegionServer";
String NUM_REFERENCE_FILES_DESC = "Number of reference file on this RegionServer";
String STOREFILE_SIZE_DESC = "Size of storefiles being served.";
String STOREFILE_SIZE_GROWTH_RATE_DESC =
"Bytes per second by which the size of storefiles being served grows.";
String TOTAL_REQUEST_COUNT = "totalRequestCount";
String TOTAL_REQUEST_COUNT_DESC =
"Total number of requests this RegionServer has answered; increments the count once for " +

View File

@ -100,6 +100,11 @@ public interface MetricsRegionServerWrapper {
*/
long getStoreFileSize();
/**
* Get the growth rate of the store files this region server is serving from.
*/
double getStoreFileSizeGrowthRate();
/**
* @return Max age of store files hosted on this region server
*/

View File

@ -482,6 +482,8 @@ public class MetricsRegionServerSourceImpl
rsWrap.getNumStoreFiles())
.addGauge(Interns.info(MEMSTORE_SIZE, MEMSTORE_SIZE_DESC), rsWrap.getMemStoreSize())
.addGauge(Interns.info(STOREFILE_SIZE, STOREFILE_SIZE_DESC), rsWrap.getStoreFileSize())
.addGauge(Interns.info(STOREFILE_SIZE_GROWTH_RATE, STOREFILE_SIZE_GROWTH_RATE_DESC),
rsWrap.getStoreFileSizeGrowthRate())
.addGauge(Interns.info(MAX_STORE_FILE_AGE, MAX_STORE_FILE_AGE_DESC),
rsWrap.getMaxStoreFileAge())
.addGauge(Interns.info(MIN_STORE_FILE_AGE, MIN_STORE_FILE_AGE_DESC),

View File

@ -68,6 +68,7 @@ class MetricsRegionServerWrapperImpl
private volatile long numStoreFiles = 0;
private volatile long memstoreSize = 0;
private volatile long storeFileSize = 0;
private volatile double storeFileSizeGrowthRate = 0;
private volatile long maxStoreFileAge = 0;
private volatile long minStoreFileAge = 0;
private volatile long avgStoreFileAge = 0;
@ -512,6 +513,11 @@ class MetricsRegionServerWrapperImpl
return storeFileSize;
}
@Override
public double getStoreFileSizeGrowthRate() {
return storeFileSizeGrowthRate;
}
@Override public double getRequestsPerSecond() {
return requestsPerSecond;
}
@ -730,6 +736,7 @@ class MetricsRegionServerWrapperImpl
private long lastRequestCount = 0;
private long lastReadRequestsCount = 0;
private long lastWriteRequestsCount = 0;
private long lastStoreFileSize = 0;
@Override
synchronized public void run() {
@ -870,18 +877,20 @@ class MetricsRegionServerWrapperImpl
long intervalReadRequestsCount = tempReadRequestsCount - lastReadRequestsCount;
long intervalWriteRequestsCount = tempWriteRequestsCount - lastWriteRequestsCount;
double readRequestsRatePerMilliSecond = ((double)intervalReadRequestsCount/
(double)period);
double writeRequestsRatePerMilliSecond = ((double)intervalWriteRequestsCount/
(double)period);
double readRequestsRatePerMilliSecond = (double)intervalReadRequestsCount / period;
double writeRequestsRatePerMilliSecond = (double)intervalWriteRequestsCount / period;
readRequestsRatePerSecond = readRequestsRatePerMilliSecond * 1000.0;
writeRequestsRatePerSecond = writeRequestsRatePerMilliSecond * 1000.0;
long intervalStoreFileSize = tempStoreFileSize - lastStoreFileSize;
storeFileSizeGrowthRate = (double)intervalStoreFileSize * 1000.0 / period;
lastReadRequestsCount = tempReadRequestsCount;
lastWriteRequestsCount = tempWriteRequestsCount;
lastStoreFileSize = tempStoreFileSize;
}
lastRan = currentTime;
WALProvider provider = regionServer.walFactory.getWALProvider();

View File

@ -70,6 +70,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
return 1900;
}
@Override
public double getStoreFileSizeGrowthRate() {
return 50.0;
}
@Override
public long getMaxStoreFileAge() {
return 2;
@ -222,7 +227,7 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
@Override
public long getMemStoreLimit() {
return 419;
return 419;
}
@Override

View File

@ -78,6 +78,7 @@ public class TestMetricsRegionServer {
HELPER.assertGauge("storeFileCount", 300, serverSource);
HELPER.assertGauge("memstoreSize", 1025, serverSource);
HELPER.assertGauge("storeFileSize", 1900, serverSource);
HELPER.assertGauge("storeFileSizeGrowthRate", 50.0, serverSource);
HELPER.assertCounter("totalRequestCount", 899, serverSource);
HELPER.assertCounter("totalRowActionRequestCount",
HELPER.getCounter("readRequestCount", serverSource)