You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by li...@apache.org on 2013/01/13 20:18:53 UTC

svn commit: r1432704 - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/io/hfile/ main/java/org/apache/hadoop/hbase/regionserver/metrics/ test/java/org/apache/hadoop/hbase/regionserver/

Author: liyin
Date: Sun Jan 13 19:18:52 2013
New Revision: 1432704

URL: http://svn.apache.org/viewvc?rev=1432704&view=rev
Log:
[HBASE-7511] Export preads latency metrics from HRegionServer metrics

Author: rshroff

Summary:
HBase already populates the preads latencies at HFile level but does not
export it via jmx. This change exports the fsPreadlatency metrics.

It also gets rid of the fsReadLatency metrics because these are not
populated as HBase now does only preads.

Test Plan:
Tested on hbase817.ash3 with custom build. After RS restart the metrics
were getting populated.

http://fburl.com/9226339 (check 3:45pm onwards)
http://fburl.com/9226350 (")

Reviewers: liyintang

Reviewed By: liyintang

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D671587

Task ID: 1996587

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
    hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java?rev=1432704&r1=1432703&r2=1432704&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java Sun Jan 13 19:18:52 2013
@@ -159,9 +159,6 @@ public class HFile {
    */
   public final static int MIN_NUM_HFILE_PATH_LEVELS = 5;
 
-  // For measuring latency of "sequential" reads and writes
-  static final AtomicInteger readOps = new AtomicInteger();
-  static final AtomicLong readTimeNano = new AtomicLong();
   static final AtomicInteger writeOps = new AtomicInteger();
   static final AtomicLong writeTimeNano = new AtomicLong();
 
@@ -170,20 +167,6 @@ public class HFile {
   static final AtomicLong preadTimeNano = new AtomicLong();
 
   /**
-   * Get the number of sequential read (seek-and-read) operations and reset it to zero.
-   */
-  public static final int getReadOpsAndReset() {
-    return readOps.getAndSet(0);
-  }
-
-  /**
-   * Get the total time of sequential reads in milliseconds and reset it to zero.
-   */
-  public static final long getReadTimeMsAndReset() {
-    return readTimeNano.getAndSet(0) / 1000000;
-  }
-
-  /**
    * Get the number of positional read operations and reset it to zero.
    */
   public static final int getPreadOpsAndReset() {

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=1432704&r1=1432703&r2=1432704&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Sun Jan 13 19:18:52 2013
@@ -168,16 +168,10 @@ public class RegionServerMetrics impleme
     new MetricsIntValue("compactionQueueSize", registry);
 
   /**
-   * filesystem read latency for seek-and-read operations
-   */
-  public final MetricsTimeVaryingRate fsReadLatency =
-    new MetricsTimeVaryingRate("fsReadLatency", registry);
-
-  /**
    * filesystem read latency for positional read operations
    */
-  public final MetricsTimeVaryingRate fsPreadLatency =
-      new MetricsTimeVaryingRate("fsPreadLatency", registry);
+  public final MetricsTimeVaryingRate fsReadLatency =
+      new MetricsTimeVaryingRate("fsReadLatency", registry);
 
   /**
    * filesystem write latency
@@ -340,8 +334,6 @@ public class RegionServerMetrics impleme
 
       // HFile metrics
       collectHFileMetric(fsReadLatency,
-          HFile.getReadOpsAndReset(), HFile.getReadTimeMsAndReset());
-      collectHFileMetric(fsPreadLatency,
           HFile.getPreadOpsAndReset(), HFile.getPreadTimeMsAndReset());
 
       /* NOTE: removed HFile write latency.  2 reasons:

Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java?rev=1432704&r1=1432703&r2=1432704&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java (original)
+++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/regionserver/HFileReadWriteTest.java Sun Jan 13 19:18:52 2013
@@ -641,7 +641,7 @@ public class HFileReadWriteTest {
 
     private volatile boolean stopRequested;
     private volatile Thread thread;
-    private long totalSeekAndReads, totalPositionalReads;
+    private long totalPositionalReads;
 
     /**
      * Run the statistics collector in a separate thread without an executor.
@@ -696,13 +696,10 @@ public class HFileReadWriteTest {
       // accumulate them here. HRegion metrics publishing thread should not
       // be running in this tool, so no one else should be resetting these
       // metrics.
-      totalSeekAndReads += HFile.getReadOpsAndReset();
       totalPositionalReads += HFile.getPreadOpsAndReset();
-      long totalBlocksRead = totalSeekAndReads + totalPositionalReads;
+      
+      double blkReadPerSec = totalPositionalReads / timeSec;
 
-      double blkReadPerSec = totalBlocksRead / timeSec;
-
-      double seekReadPerSec = totalSeekAndReads / timeSec;
       double preadPerSec = totalPositionalReads / timeSec;
 
       boolean isRead = workload == Workload.RANDOM_READS;
@@ -716,9 +713,8 @@ public class HFileReadWriteTest {
       sb.append(", blk/sec: " + (long) blkReadPerSec);
       sb.append(", total KV: " + numKV);
       sb.append(", total bytes: " + totalBytes);
-      sb.append(", total blk: " + totalBlocksRead);
+      sb.append(", total blk: " + totalPositionalReads);
 
-      sb.append(", seekRead/sec: " + (long) seekReadPerSec);
       sb.append(", pread/sec: " + (long) preadPerSec);
 
       if (isRead)