HBASE-3292 Expose block cache hit/miss/evict counts into region server metrics
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1041936 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7650309d06
commit
00c0dec88b
|
@ -16,6 +16,8 @@ Release 0.91.0 - Unreleased
|
|||
HBASE-2001 Coprocessors: Colocate user code with regions (Mingjie Lai via
|
||||
Andrew Purtell)
|
||||
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
||||
HBASE-3292 Expose block cache hit/miss/evict counts into region server
|
||||
metrics
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-3287 Add option to cache blocks on hfile write and evict blocks on
|
||||
|
|
|
@ -94,6 +94,7 @@ import org.apache.hadoop.hbase.client.coprocessor.ExecResult;
|
|||
import org.apache.hadoop.hbase.executor.ExecutorService;
|
||||
import org.apache.hadoop.hbase.executor.ExecutorService.ExecutorType;
|
||||
import org.apache.hadoop.hbase.io.hfile.LruBlockCache;
|
||||
import org.apache.hadoop.hbase.io.hfile.LruBlockCache.CacheStats;
|
||||
import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
|
||||
import org.apache.hadoop.hbase.ipc.HBaseRPC;
|
||||
import org.apache.hadoop.hbase.ipc.HBaseRPCErrorHandler;
|
||||
|
@ -1161,6 +1162,10 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
this.metrics.blockCacheCount.set(lruBlockCache.size());
|
||||
this.metrics.blockCacheFree.set(lruBlockCache.getFreeSize());
|
||||
this.metrics.blockCacheSize.set(lruBlockCache.getCurrentSize());
|
||||
CacheStats cacheStats = lruBlockCache.getStats();
|
||||
this.metrics.blockCacheHitCount.set(cacheStats.getHitCount());
|
||||
this.metrics.blockCacheMissCount.set(cacheStats.getMissCount());
|
||||
this.metrics.blockCacheEvictedCount.set(lruBlockCache.getEvictedCount());
|
||||
double ratio = lruBlockCache.getStats().getHitRatio();
|
||||
int percent = (int) (ratio * 100);
|
||||
this.metrics.blockCacheHitRatio.set(percent);
|
||||
|
|
|
@ -86,6 +86,21 @@ public class RegionServerMetrics implements Updater {
|
|||
*/
|
||||
public final MetricsLongValue blockCacheCount = new MetricsLongValue("blockCacheCount", registry);
|
||||
|
||||
/**
|
||||
* Block cache hit count.
|
||||
*/
|
||||
public final MetricsLongValue blockCacheHitCount = new MetricsLongValue("blockCacheHitCount", registry);
|
||||
|
||||
/**
|
||||
* Block cache miss count.
|
||||
*/
|
||||
public final MetricsLongValue blockCacheMissCount = new MetricsLongValue("blockCacheMissCount", registry);
|
||||
|
||||
/**
|
||||
* Block cache evict count.
|
||||
*/
|
||||
public final MetricsLongValue blockCacheEvictedCount = new MetricsLongValue("blockCacheEvictedCount", registry);
|
||||
|
||||
/**
|
||||
* Block hit ratio.
|
||||
*/
|
||||
|
@ -228,6 +243,9 @@ public class RegionServerMetrics implements Updater {
|
|||
this.blockCacheSize.pushMetric(this.metricsRecord);
|
||||
this.blockCacheFree.pushMetric(this.metricsRecord);
|
||||
this.blockCacheCount.pushMetric(this.metricsRecord);
|
||||
this.blockCacheHitCount.pushMetric(this.metricsRecord);
|
||||
this.blockCacheMissCount.pushMetric(this.metricsRecord);
|
||||
this.blockCacheEvictedCount.pushMetric(this.metricsRecord);
|
||||
this.blockCacheHitRatio.pushMetric(this.metricsRecord);
|
||||
this.blockCacheHitCachingRatio.pushMetric(this.metricsRecord);
|
||||
|
||||
|
@ -336,6 +354,12 @@ public class RegionServerMetrics implements Updater {
|
|||
Long.valueOf(this.blockCacheFree.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheCount.getName(),
|
||||
Long.valueOf(this.blockCacheCount.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheHitCount.getName(),
|
||||
Long.valueOf(this.blockCacheHitCount.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheMissCount.getName(),
|
||||
Long.valueOf(this.blockCacheMissCount.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheEvictedCount.getName(),
|
||||
Long.valueOf(this.blockCacheEvictedCount.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheHitRatio.getName(),
|
||||
Long.valueOf(this.blockCacheHitRatio.get()));
|
||||
sb = Strings.appendKeyValue(sb, this.blockCacheHitCachingRatio.getName(),
|
||||
|
|
Loading…
Reference in New Issue