hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liang...@apache.org
Subject svn commit: r1594118 - in /hbase/branches/0.98: hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/ hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/
Date Tue, 13 May 2014 03:18:47 GMT
Author: liangxie
Date: Tue May 13 03:18:46 2014
New Revision: 1594118

URL: http://svn.apache.org/r1594118
Log:
HBASE-10561 Forward port: HBASE-10212 New rpc metric: number of active handler

Modified:
    hbase/branches/0.98/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcScheduler.java
    hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
    hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java

Modified: hbase/branches/0.98/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
(original)
+++ hbase/branches/0.98/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
Tue May 13 03:18:46 2014
@@ -25,4 +25,5 @@ public interface MetricsHBaseServerWrapp
   int getReplicationQueueLength();
   int getPriorityQueueLength();
   int getNumOpenConnections();
+  int getActiveRpcHandlerCount();
 }

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FifoRpcScheduler.java
Tue May 13 03:18:46 2014
@@ -89,4 +89,9 @@ public class FifoRpcScheduler implements
   public int getReplicationQueueLength() {
     return 0;
   }
+
+  @Override
+  public int getActiveRpcHandlerCount() {
+    return executor.getActiveCount();
+  }
 }

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
Tue May 13 03:18:46 2014
@@ -37,8 +37,7 @@ public class MetricsHBaseServerWrapperIm
 
   @Override
   public int getGeneralQueueLength() {
-    if (this.server == null
-        || this.server.getScheduler() == null) {
+    if (this.server == null || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getGeneralQueueLength();
@@ -46,8 +45,7 @@ public class MetricsHBaseServerWrapperIm
 
   @Override
   public int getReplicationQueueLength() {
-    if (this.server == null
-        || this.server.getScheduler() == null) {
+    if (this.server == null || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getReplicationQueueLength();
@@ -55,8 +53,7 @@ public class MetricsHBaseServerWrapperIm
 
   @Override
   public int getPriorityQueueLength() {
-    if (this.server == null
-        || this.server.getScheduler() == null) {
+    if (this.server == null || this.server.getScheduler() == null) {
       return 0;
     }
     return server.getScheduler().getPriorityQueueLength();
@@ -69,4 +66,12 @@ public class MetricsHBaseServerWrapperIm
     }
     return server.connectionList.size();
   }
+
+  @Override
+  public int getActiveRpcHandlerCount() {
+    if (this.server == null || this.server.getScheduler() == null) {
+      return 0;
+    }
+    return server.getScheduler().getActiveRpcHandlerCount();
+  }
 }

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcScheduler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcScheduler.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcScheduler.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcScheduler.java
Tue May 13 03:18:46 2014
@@ -67,4 +67,7 @@ public interface RpcScheduler {
 
   /** Retrieves length of the replication queue for metrics. */
   int getReplicationQueueLength();
+
+  /** Retrieves the number of active handler. */
+  int getActiveRpcHandlerCount();
 }

Modified: hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
(original)
+++ hbase/branches/0.98/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcScheduler.java
Tue May 13 03:18:46 2014
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.ipc;
 import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -47,7 +48,7 @@ public class SimpleRpcScheduler implemen
   final BlockingQueue<CallRunner> replicationQueue;
   private volatile boolean running = false;
   private final List<Thread> handlers = Lists.newArrayList();
-
+  private AtomicInteger activeHandlerCount = new AtomicInteger(0);
   /** What level a high priority call is at. */
   private final int highPriorityLevel;
 
@@ -153,11 +154,21 @@ public class SimpleRpcScheduler implemen
     return replicationQueue == null ? 0 : replicationQueue.size();
   }
 
+  @Override
+  public int getActiveRpcHandlerCount() {
+    return 0;
+  }
+
   private void consumerLoop(BlockingQueue<CallRunner> myQueue) {
     while (running) {
       try {
         CallRunner task = myQueue.take();
-        task.run();
+        try {
+          activeHandlerCount.incrementAndGet();
+          task.run();
+        } finally {
+          activeHandlerCount.decrementAndGet();
+        }
       } catch (InterruptedException e) {
         Thread.currentThread().interrupt();
       }

Modified: hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java?rev=1594118&r1=1594117&r2=1594118&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
(original)
+++ hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
Tue May 13 03:18:46 2014
@@ -43,4 +43,9 @@ public class MetricsHBaseServerWrapperSt
   public int getNumOpenConnections() {
     return 105;
   }
+
+  @Override
+  public int getActiveRpcHandlerCount() {
+    return 100;
+  }
 }



Mime
View raw message