hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/3] hbase git commit: HBASE-12496 A blockedRequestsCount metric (Yi Deng)
Date Tue, 18 Nov 2014 22:36:00 GMT
HBASE-12496 A blockedRequestsCount metric (Yi Deng)


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

Branch: refs/heads/0.98
Commit: ae0ecedab576e2079fae85611c1d17eee678b6a4
Parents: d019e37
Author: Andrew Purtell <apurtell@apache.org>
Authored: Tue Nov 18 14:14:31 2014 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Tue Nov 18 14:32:32 2014 -0800

----------------------------------------------------------------------
 .../hbase/regionserver/MetricsRegionServerSource.java  |  4 ++++
 .../hbase/regionserver/MetricsRegionServerWrapper.java |  5 +++++
 .../regionserver/MetricsRegionServerSourceImpl.java    |  4 ++++
 .../regionserver/MetricsRegionServerSourceImpl.java    |  4 ++++
 .../org/apache/hadoop/hbase/regionserver/HRegion.java  | 13 ++++++++++++-
 .../regionserver/MetricsRegionServerWrapperImpl.java   |  9 +++++++++
 .../regionserver/MetricsRegionServerWrapperStub.java   |  6 +++++-
 7 files changed, 43 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
index 7642b0e..2facb3b 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSource.java
@@ -246,6 +246,10 @@ public interface MetricsRegionServerSource extends BaseSource {
   String MAJOR_COMPACTED_CELLS_SIZE_DESC =
       "The total amount of data processed during major compactions, in bytes";
 
+  String BLOCKED_REQUESTS_COUNT = "blockedRequestCount";
+  String BLOCKED_REQUESTS_COUNT_DESC = "The number of blocked requests because of memstore
size is "
+      + "larger than blockingMemStoreSize";
+
   String SPLIT_KEY = "splitTime";
   String FLUSH_KEY = "flushTime";
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
index e95213c..6ac3e2d 100644
--- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
+++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapper.java
@@ -246,4 +246,9 @@ public interface MetricsRegionServerWrapper {
    * Get the total amount of data processed during major compactions, in bytes.
    */
   long getMajorCompactedCellsSize();
+
+  /**
+   * @return Count of requests blocked because the memstore size is larger than blockingMemStoreSize
+   */
+  public long getBlockedRequestsCount();
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
index ffb3055..5968efd 100644
--- a/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
+++ b/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
@@ -227,6 +227,10 @@ public class MetricsRegionServerSourceImpl
               rsWrap.getCompactedCellsSize())
           .addCounter(MAJOR_COMPACTED_CELLS_SIZE, MAJOR_COMPACTED_CELLS_SIZE_DESC,
               rsWrap.getMajorCompactedCellsSize())
+
+          .addCounter(BLOCKED_REQUESTS_COUNT, BLOCKED_REQUESTS_COUNT_DESC,
+              rsWrap.getBlockedRequestsCount())
+
           .tag(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC, rsWrap.getZookeeperQuorum())
           .tag(SERVER_NAME_NAME, SERVER_NAME_DESC, rsWrap.getServerName())
           .tag(CLUSTER_ID_NAME, CLUSTER_ID_DESC, rsWrap.getClusterId());

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
index 25866f3..c7b26b6 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
@@ -232,6 +232,10 @@ public class MetricsRegionServerSourceImpl
               rsWrap.getCompactedCellsSize())
           .addCounter(Interns.info(MAJOR_COMPACTED_CELLS_SIZE, MAJOR_COMPACTED_CELLS_SIZE_DESC),
               rsWrap.getMajorCompactedCellsSize())
+
+          .addCounter(Interns.info(BLOCKED_REQUESTS_COUNT, BLOCKED_REQUESTS_COUNT_DESC),
+            rsWrap.getBlockedRequestsCount())
+
           .tag(Interns.info(ZOOKEEPER_QUORUM_NAME, ZOOKEEPER_QUORUM_DESC),
               rsWrap.getZookeeperQuorum())
           .tag(Interns.info(SERVER_NAME_NAME, SERVER_NAME_DESC), rsWrap.getServerName())

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index ccb8668..39a9fdc 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -265,6 +265,16 @@ public class HRegion implements HeapSize { // , Writable{
   final Counter readRequestsCount = new Counter();
   final Counter writeRequestsCount = new Counter();
 
+  // Number of requests blocked by memstore size.
+  private final Counter blockedRequestsCount = new Counter();
+
+  /**
+   * @return the number of blocked requests count.
+   */
+  public long getBlockedRequestsCount() {
+    return this.blockedRequestsCount.get();
+  }
+
   // Compaction counters
   final AtomicLong compactionsFinished = new AtomicLong(0L);
   final AtomicLong compactionNumFilesCompacted = new AtomicLong(0L);
@@ -2933,6 +2943,7 @@ public class HRegion implements HeapSize { // , Writable{
     if (this.getRegionInfo().isMetaRegion()) return;
 
     if (this.memstoreSize.get() > this.blockingMemStoreSize) {
+      blockedRequestsCount.increment();
       requestFlush();
       throw new RegionTooBusyException("Above memstore limit, " +
           "regionName=" + (this.getRegionInfo() == null ? "unknown" :
@@ -5564,7 +5575,7 @@ public class HRegion implements HeapSize { // , Writable{
   public static final long FIXED_OVERHEAD = ClassSize.align(
       ClassSize.OBJECT +
       ClassSize.ARRAY +
-      41 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
+      42 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT +
       (12 * Bytes.SIZEOF_LONG) +
       4 * Bytes.SIZEOF_BOOLEAN);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
index 20ed312..af51332 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java
@@ -72,6 +72,7 @@ class MetricsRegionServerWrapperImpl
   private volatile long flushedCellsSize = 0;
   private volatile long compactedCellsSize = 0;
   private volatile long majorCompactedCellsSize = 0;
+  private volatile long blockedRequestsCount = 0L;
 
   private CacheStats cacheStats;
   private ScheduledExecutorService executor;
@@ -427,6 +428,7 @@ class MetricsRegionServerWrapperImpl
       long tempFlushedCellsSize = 0;
       long tempCompactedCellsSize = 0;
       long tempMajorCompactedCellsSize = 0;
+      long tempBlockedRequestsCount = 0L;
 
       for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {
         tempNumMutationsWithoutWAL += r.numMutationsWithoutWAL.get();
@@ -435,6 +437,7 @@ class MetricsRegionServerWrapperImpl
         tempWriteRequestsCount += r.writeRequestsCount.get();
         tempCheckAndMutateChecksFailed += r.checkAndMutateChecksFailed.get();
         tempCheckAndMutateChecksPassed += r.checkAndMutateChecksPassed.get();
+        tempBlockedRequestsCount += r.getBlockedRequestsCount();
         tempNumStores += r.stores.size();
         for (Store store : r.stores.values()) {
           tempNumStoreFiles += store.getStorefilesCount();
@@ -511,6 +514,12 @@ class MetricsRegionServerWrapperImpl
       flushedCellsSize = tempFlushedCellsSize;
       compactedCellsSize = tempCompactedCellsSize;
       majorCompactedCellsSize = tempMajorCompactedCellsSize;
+      blockedRequestsCount = tempBlockedRequestsCount;
     }
   }
+
+  @Override
+  public long getBlockedRequestsCount() {
+    return blockedRequestsCount;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/ae0eceda/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
index 3763355..6502be1 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperStub.java
@@ -241,4 +241,8 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
     return 10240000;
   }
 
-}
\ No newline at end of file
+  @Override
+  public long getBlockedRequestsCount() {
+    return 0;
+  }
+}


Mime
View raw message