hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenh...@apache.org
Subject hbase git commit: HBASE-15635 Mean age of Blocks in cache (seconds) on webUI should be greater than zero
Date Thu, 18 Aug 2016 03:00:15 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 d82cf96f2 -> 941ad56e7


HBASE-15635 Mean age of Blocks in cache (seconds) on webUI should be greater than zero

Conflicts:
	hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/941ad56e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/941ad56e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/941ad56e

Branch: refs/heads/branch-1.1
Commit: 941ad56e7fac6defe4978a35e46f28098f3e1439
Parents: d82cf96
Author: chenheng <chenheng@apache.org>
Authored: Thu Aug 18 10:28:06 2016 +0800
Committer: chenheng <chenheng@apache.org>
Committed: Thu Aug 18 10:57:42 2016 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon  | 11 ++---------
 .../org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java |  4 +++-
 .../org/apache/hadoop/hbase/io/hfile/CacheStats.java     |  4 +++-
 3 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/941ad56e/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
index 6986f12..a25c224 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/BlockCacheTmpl.jamon
@@ -176,9 +176,6 @@ org.apache.hadoop.util.StringUtils;
 </%args>
 <%java>
   AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot();
-  // Only show if non-zero mean and stddev as is the case in combinedblockcache
-  double mean = ageAtEvictionSnapshot.getMean();
-  double stddev = ageAtEvictionSnapshot.getStdDev();
 </%java>
     <tr>
         <td>Evicted</td>
@@ -190,20 +187,16 @@ org.apache.hadoop.util.StringUtils;
         <td><% String.format("%,d", bc.getStats().getEvictionCount()) %></td>
         <td>The total number of times an eviction has occurred</td>
     </tr>
-<%if mean > 0 %>
     <tr>
         <td>Mean</td>
-        <td><% String.format("%,d", (long)(ageAtEvictionSnapshot.getMean()/(1000000
* 1000))) %></td>
+        <td><% String.format("%,d", (long)(ageAtEvictionSnapshot.getMean())) %></td>
         <td>Mean age of Blocks at eviction time (seconds)</td>
     </tr>
-</%if>
-<%if stddev > 0 %>
     <tr>
         <td>StdDev</td>
-        <td><% String.format("%,d", (long)(ageAtEvictionSnapshot.getStdDev()/1000000))
%></td>
+        <td><% String.format("%,d", (long)(ageAtEvictionSnapshot.getStdDev())) %></td>
         <td>Standard Deviation for age of Blocks at eviction time</td>
     </tr>
-</%if>
 </%def>
 
 <%def hits_tmpl>

http://git-wip-us.apache.org/repos/asf/hbase/blob/941ad56e/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
index 94638da..2d3f524 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java
@@ -41,6 +41,8 @@ import com.yammer.metrics.stats.Snapshot;
  */
 @InterfaceAudience.Private
 public class BlockCacheUtil {
+
+  public static final long NANOS_PER_SECOND = 1000000000;
   /**
    * Needed making histograms.
    */
@@ -225,7 +227,7 @@ public class BlockCacheUtil {
         this.dataBlockCount++;
         this.dataSize += cb.getSize();
       }
-      long age = this.now - cb.getCachedTime();
+      long age = (this.now - cb.getCachedTime())/NANOS_PER_SECOND;
       this.age.update(age);
       return false;
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/941ad56e/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java
index 00accfc..ba5fbf4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheStats.java
@@ -131,7 +131,9 @@ public class CacheStats {
   }
 
   public void evicted(final long t) {
-    if (t > this.startTime) this.ageAtEviction.update(t - this.startTime);
+    if (t > this.startTime) {
+      this.ageAtEviction.update((t - this.startTime)/BlockCacheUtil.NANOS_PER_SECOND);
+    }
     this.evictedBlockCount.incrementAndGet();
   }
 


Mime
View raw message