hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1459451 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: io/hfile/HFile.java io/hfile/HFileReaderV1.java io/hfile/HFileReaderV2.java regionserver/metrics/RegionServerMetrics.java
Date Thu, 21 Mar 2013 18:52:27 GMT
Author: liyin
Date: Thu Mar 21 18:52:26 2013
New Revision: 1459451

URL: http://svn.apache.org/r1459451
Log:
[HBASE-7655] Separates pread latencies for compactions vs normal read ops

Author: rshroff

Summary:
When we read a block, we already know whether the read operation is for
compaction or a normal operation.

This change adds new metrics to separately measures this read operations
to measure the performance impact.

Test Plan:
Test it on titanshadow.
http://fburl.com/9680926

Reviewers: liyintang

Reviewed By: liyintang

CC: hbase-eng@

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

Task ID: 2043991

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/io/hfile/HFileReaderV1.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.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=1459451&r1=1459450&r2=1459451&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 Thu Mar
21 18:52:26 2013
@@ -166,6 +166,25 @@ public class HFile {
   static final AtomicInteger preadOps = new AtomicInteger();
   static final AtomicLong preadTimeNano = new AtomicLong();
 
+  //For measuring latency of pread during compactions
+  static final AtomicInteger preadCompactionOps = new AtomicInteger();
+  static final AtomicLong preadCompactionTimeNano = new AtomicLong();
+
+  /**
+   * Get the number of positional read operations during compaction
+   * and reset it to zero.
+   */
+  public static final int getPreadCompactionOpsAndReset() {
+    return preadCompactionOps.getAndSet(0);
+  }
+
+  /**
+   * Get the total time of positional reads during compaction in milliseconds and reset it
to zero.
+   */
+  public static final long getPreadCompactionTimeMsAndReset() {
+    return preadCompactionTimeNano.getAndSet(0) / 1000000;
+  }
+
   /**
    * Get the number of positional read operations and reset it to zero.
    */
@@ -598,4 +617,4 @@ public class HFile {
     }
   }
 
-}
\ No newline at end of file
+}

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java?rev=1459451&r1=1459450&r2=1459451&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java
Thu Mar 21 18:52:26 2013
@@ -320,8 +320,13 @@ public class HFileReaderV1 extends Abstr
       hfileBlock.expectType(BlockType.DATA);
 
       long delta = System.nanoTime() - startTimeNs;
-      HFile.preadTimeNano.addAndGet(delta);
-      HFile.preadOps.incrementAndGet();
+      if (isCompaction) {
+        HFile.preadCompactionTimeNano.addAndGet(delta);
+        HFile.preadCompactionOps.incrementAndGet();
+      } else {
+        HFile.preadTimeNano.addAndGet(delta);
+        HFile.preadOps.incrementAndGet();
+      }
       getSchemaMetrics().updateOnCacheMiss(BlockCategory.DATA, isCompaction,
           delta);
 

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java?rev=1459451&r1=1459450&r2=1459451&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java
Thu Mar 21 18:52:26 2013
@@ -301,9 +301,17 @@ public class HFileReaderV2 extends Abstr
       BlockCategory blockCategory = hfileBlock.getBlockType().getCategory();
 
       long deltaNs = System.nanoTime() - startTimeNs;
-      HFile.preadTimeNano.addAndGet(deltaNs);
-      HFile.preadOps.incrementAndGet();
 
+      if (isCompaction) {
+        HFile.preadCompactionTimeNano.addAndGet(deltaNs);
+        HFile.preadCompactionOps.incrementAndGet();
+      } else {
+        HFile.preadTimeNano.addAndGet(deltaNs);
+        HFile.preadOps.incrementAndGet();
+      }
+      if (obtainedFromCache != null) {
+        obtainedFromCache.set(false);
+      }
       getSchemaMetrics().updateOnCacheMiss(blockCategory, isCompaction,
           TimeUnit.NANOSECONDS.toMillis(deltaNs));
 

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=1459451&r1=1459450&r2=1459451&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
Thu Mar 21 18:52:26 2013
@@ -174,6 +174,13 @@ public class RegionServerMetrics impleme
       new MetricsTimeVaryingRate("fsReadLatency", registry);
 
   /**
+   * filesystem read latency for positional read operations during
+   * compactions
+   */
+  public final MetricsTimeVaryingRate fsCompactionReadLatency =
+      new MetricsTimeVaryingRate("fsCompactionReadLatency", registry);
+
+  /**
    * filesystem write latency
    */
   public final MetricsTimeVaryingRate fsWriteLatency =
@@ -335,6 +342,9 @@ public class RegionServerMetrics impleme
       // HFile metrics
       collectHFileMetric(fsReadLatency,
           HFile.getPreadOpsAndReset(), HFile.getPreadTimeMsAndReset());
+      collectHFileMetric(fsCompactionReadLatency,
+          HFile.getPreadCompactionOpsAndReset(),
+          HFile.getPreadCompactionTimeMsAndReset());
 
       /* NOTE: removed HFile write latency.  2 reasons:
        * 1) Mixing HLog latencies are far higher priority since they're
@@ -352,6 +362,7 @@ public class RegionServerMetrics impleme
 
       // push the result
       this.fsReadLatency.pushMetric(this.metricsRecord);
+      this.fsCompactionReadLatency.pushMetric(this.metricsRecord);
       this.fsWriteLatency.pushMetric(this.metricsRecord);
       this.fsWriteSize.pushMetric(this.metricsRecord);
       this.fsSyncLatency.pushMetric(this.metricsRecord);
@@ -409,6 +420,7 @@ public class RegionServerMetrics impleme
     this.flushSize.resetMinMaxAvg();
     this.atomicIncrementTime.resetMinMax();
     this.fsReadLatency.resetMinMax();
+    this.fsCompactionReadLatency.resetMinMax();
     this.fsWriteLatency.resetMinMax();
     this.fsWriteSize.resetMinMax();
     this.fsSyncLatency.resetMinMax();



Mime
View raw message