David Manning created HBASE-27159:
-------------------------------------

             Summary: Emit source metrics for BlockCacheExpressHitPercent, 
getHitCachingRatio, getHitCachingCount, getMissCachingCount
                 Key: HBASE-27159
                 URL: https://issues.apache.org/jira/browse/HBASE-27159
             Project: HBase
          Issue Type: Improvement
          Components: BlockCache, metrics
    Affects Versions: 2.0.0, 3.0.0-alpha-1
            Reporter: David Manning


[https://github.com/apache/hbase/blob/d447fa01ba36a11d57927b78cce1bbca361b1d52/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java#L346-L400]
{code:java}
public double getHitCachingRatio() {
  double requestCachingCount = getRequestCachingCount();
  if (requestCachingCount == 0) {
    return 0;
  }
  return getHitCachingCount() / requestCachingCount;
} {code}
This code is responsible for the metric {{{}BlockCacheExpressHitPercent{}}}. 
The metric represents the percentage of requests which were cacheable, but not 
found in the cache. Unfortunately, since the counters are process-level 
counters, the ratio is for the lifetime of the process. This makes it less 
useful for looking at cache behavior during a smaller time period.

The underlying counters are {{hitCachingCount}} and {{{}missCachingCount{}}}. 
Having access to the underlying counters allows for offline computation of the 
same metric for any given time period. But these counters are not emitted today 
from {{{}MetricsRegionServerWrapperImpl.java{}}}.

Compare this to {{hitCount}} and {{missCount}} which are emitted as metrics 
{{blockCacheHitCount}} and {{{}blockCacheMissCount{}}}. But these are raw 
counts for the cache, which include requests that are not cacheable. The 
cacheable metrics are more interesting, since it can be common to miss on a 
request which is not cacheable.

We should emit blockCache{{{}HitCachingCount{}}} and 
{{blockCacheMissCachingCount}} along with the current metrics.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to