hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liang...@apache.org
Subject svn commit: r1594131 - in /hbase/branches/0.96: hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/ hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/ hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/ hbase-server/...
Date Tue, 13 May 2014 05:34:53 GMT
Author: liangxie
Date: Tue May 13 05:34:52 2014
New Revision: 1594131

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

Modified:
    hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
    hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
    hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
    hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java

Modified: hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
(original)
+++ hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSource.java
Tue May 13 05:34:52 2014
@@ -53,6 +53,8 @@ public interface MetricsHBaseServerSourc
   String PRIORITY_QUEUE_DESC = "Number of calls in the priority call queue.";
   String NUM_OPEN_CONNECTIONS_NAME = "numOpenConnections";
   String NUM_OPEN_CONNECTIONS_DESC = "Number of open connections.";
+  String NUM_ACTIVE_HANDLER_NAME = "numActiveHandler";
+  String NUM_ACTIVE_HANDLER_DESC = "Number of active rpc handlers.";
 
   void authorizationSuccess();
 

Modified: hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
(original)
+++ hbase/branches/0.96/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapper.java
Tue May 13 05:34:52 2014
@@ -25,4 +25,5 @@ public interface MetricsHBaseServerWrapp
   int getReplicationQueueLength();
   int getPriorityQueueLength();
   int getNumOpenConnections();
+  long getActiveRpcHandlerCount();
 }

Modified: hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop1-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
Tue May 13 05:34:52 2014
@@ -116,7 +116,9 @@ public class MetricsHBaseServerSourceImp
               REPLICATION_QUEUE_DESC, wrapper.getReplicationQueueLength())
           .addGauge(PRIORITY_QUEUE_NAME, PRIORITY_QUEUE_DESC, wrapper.getPriorityQueueLength())
           .addGauge(NUM_OPEN_CONNECTIONS_NAME,
-              NUM_OPEN_CONNECTIONS_DESC, wrapper.getNumOpenConnections());
+              NUM_OPEN_CONNECTIONS_DESC, wrapper.getNumOpenConnections())
+          .addGauge(NUM_ACTIVE_HANDLER_NAME,
+              NUM_ACTIVE_HANDLER_DESC, wrapper.getActiveRpcHandlerCount());
     }
 
     metricsRegistry.snapshot(mrb, all);

Modified: hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
(original)
+++ hbase/branches/0.96/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerSourceImpl.java
Tue May 13 05:34:52 2014
@@ -122,7 +122,9 @@ public class MetricsHBaseServerSourceImp
           .addGauge(Interns.info(PRIORITY_QUEUE_NAME, PRIORITY_QUEUE_DESC),
               wrapper.getPriorityQueueLength())
           .addGauge(Interns.info(NUM_OPEN_CONNECTIONS_NAME,
-              NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections());
+              NUM_OPEN_CONNECTIONS_DESC), wrapper.getNumOpenConnections())
+          .addGauge(Interns.info(NUM_ACTIVE_HANDLER_NAME,
+              NUM_ACTIVE_HANDLER_DESC), wrapper.getActiveRpcHandlerCount());
     }
 
     metricsRegistry.snapshot(mrb, all);

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperImpl.java
Tue May 13 05:34:52 2014
@@ -66,4 +66,12 @@ public class MetricsHBaseServerWrapperIm
     }
     return server.connectionList.size();
   }
+
+  @Override
+  public long getActiveRpcHandlerCount() {
+    if (this.server == null || this.server.handlers == null) {
+      return 0;
+    }
+    return server.activeRpcCount.get();
+  }
 }

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
Tue May 13 05:34:52 2014
@@ -215,6 +215,7 @@ public class RpcServer implements RpcSer
   protected BlockingQueue<Call> callQueue; // queued calls
   protected final Counter callQueueSize = new Counter();
   protected BlockingQueue<Call> priorityCallQueue;
+  protected final Counter activeRpcCount = new Counter();
 
   protected int highPriorityLevel;  // what level a high priority call is at
 
@@ -225,7 +226,7 @@ public class RpcServer implements RpcSer
   private Listener listener = null;
   protected Responder responder = null;
   protected int numConnections = 0;
-  private Handler[] handlers = null;
+  protected Handler[] handlers = null;
   private Handler[] priorityHandlers = null;
   /** replication related queue; */
   protected BlockingQueue<Call> replicationQueue;
@@ -1875,6 +1876,7 @@ public class RpcServer implements RpcSer
           CurCall.set(call);
           TraceScope traceScope = null;
           try {
+            activeRpcCount.increment();
             if (!started) {
               throw new ServerNotRunningYetException("Server is not running yet");
             }
@@ -1899,6 +1901,7 @@ public class RpcServer implements RpcSer
             // Must always clear the request context to avoid leaking
             // credentials between requests.
             RequestContext.clear();
+            activeRpcCount.decrement();
           }
           CurCall.set(null);
           callQueueSize.add(call.getSize() * -1);

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/MetricsHBaseServerWrapperStub.java
Tue May 13 05:34:52 2014
@@ -43,4 +43,9 @@ public class MetricsHBaseServerWrapperSt
   public int getNumOpenConnections() {
     return 105;
   }
+
+  @Override
+  public long getActiveRpcHandlerCount() {
+    return 106;
+  }
 }

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java?rev=1594131&r1=1594130&r2=1594131&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java
Tue May 13 05:34:52 2014
@@ -64,6 +64,7 @@ public class TestRpcMetrics {
     HELPER.assertGauge("numCallsInReplicationQueue", 103, serverSource);
     HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
     HELPER.assertGauge("numOpenConnections", 105, serverSource);
+    HELPER.assertGauge("numActiveHandler", 106, serverSource);
   }
 
   /**



Mime
View raw message