Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-27159

Emit source metrics for BlockCacheExpressHitPercent

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      https://github.com/apache/hbase/blob/d447fa01ba36a11d57927b78cce1bbca361b1d52/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java#L346-L400

      public double getHitCachingRatio() {
        double requestCachingCount = getRequestCachingCount();
        if (requestCachingCount == 0) {
          return 0;
        }
        return getHitCachingCount() / requestCachingCount;
      } 

      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.

      Interestingly, these metrics are emitted regularly as part of a log line in StatisticsThread.logStats.

      We should emit blockCacheHitCachingCount and blockCacheMissCachingCount along with the current metrics.

      Attachments

        Issue Links

          Activity

            People

              dmanning David Manning
              dmanning David Manning
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: