HBASE-5538 A metric to measure the size of the response queue in the hbase rpc server

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1299084 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-03-09 22:40:12 +00:00
parent 293114eb51
commit 7d34da889e
2 changed files with 7 additions and 0 deletions

View File

@ -90,6 +90,8 @@ public class HBaseRpcMetrics implements Updater {
new MetricsIntValue("callQueueLen", registry);
public final MetricsIntValue priorityCallQueueLen =
new MetricsIntValue("priorityCallQueueLen", registry);
public final MetricsIntValue responseQueueLen =
new MetricsIntValue("responseQueueLen", registry);
public final MetricsTimeVaryingInt authenticationFailures =
new MetricsTimeVaryingInt("rpcAuthenticationFailures", registry);
public final MetricsTimeVaryingInt authenticationSuccesses =

View File

@ -203,6 +203,8 @@ public abstract class HBaseServer implements RpcServer {
protected int highPriorityLevel; // what level a high priority call is at
private volatile int responseQueueLen; // size of response queue for this server
protected final List<Connection> connectionList =
Collections.synchronizedList(new LinkedList<Connection>());
//maintain a list
@ -929,6 +931,7 @@ public abstract class HBaseServer implements RpcServer {
return true;
}
if (!call.response.hasRemaining()) {
responseQueueLen--;
call.connection.decRpcCount();
//noinspection RedundantIfStatement
if (numElements == 1) { // last call fully processes.
@ -998,6 +1001,7 @@ public abstract class HBaseServer implements RpcServer {
void doRespond(Call call) throws IOException {
// set the serve time when the response has to be sent later
call.timestamp = System.currentTimeMillis();
responseQueueLen++;
boolean doRegister = false;
synchronized (call.connection.responseQueue) {
@ -1287,6 +1291,7 @@ public abstract class HBaseServer implements RpcServer {
} else {
LOG.warn("Unknown call queue");
}
rpcMetrics.responseQueueLen.set(responseQueueLen);
}
/** Handles queued calls . */