hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhr...@apache.org
Subject svn commit: r639359 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/ipc/RPC.java src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java
Date Thu, 20 Mar 2008 17:06:07 GMT
Author: dhruba
Date: Thu Mar 20 10:06:02 2008
New Revision: 639359

URL: http://svn.apache.org/viewvc?rev=639359&view=rev
Log:
HADOOP-2886.  Track individual RPC metrics.
(girish vaitheeswaran via dhruba)


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/ipc/RPC.java
    hadoop/core/trunk/src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=639359&r1=639358&r2=639359&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Thu Mar 20 10:06:02 2008
@@ -126,6 +126,9 @@
     HADOOP-2899. [HOD] Cleans up hdfs:///mapredsystem directory after
     deallocation. (Hemanth Yamijala via ddas) 
 
+    HADOOP-2886.  Track individual RPC metrics.
+    (girish vaitheeswaran via dhruba)
+
   OPTIMIZATIONS
 
     HADOOP-2790.  Fixed inefficient method hasSpeculativeTask by removing

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/ipc/RPC.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/ipc/RPC.java?rev=639359&r1=639358&r2=639359&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/ipc/RPC.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/ipc/RPC.java Thu Mar 20 10:06:02 2008
@@ -40,6 +40,7 @@
 import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.conf.*;
+import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
 
 /** A simple RPC mechanism.
  *
@@ -450,7 +451,18 @@
             " procesingTime= " + processingTime);
         rpcMetrics.rpcQueueTime.inc(qTime);
         rpcMetrics.rpcProcessingTime.inc(processingTime);
-        
+
+	MetricsTimeVaryingRate m = rpcMetrics.metricsList.get(call.getMethodName());
+
+	if (m != null) {
+		m.inc(processingTime);
+	}
+	else {
+		rpcMetrics.metricsList.put(call.getMethodName(), new MetricsTimeVaryingRate(call.getMethodName()));
+		m = rpcMetrics.metricsList.get(call.getMethodName());
+		m.inc(processingTime);
+	}
+
         if (verbose) log("Return: "+value);
 
         return new ObjectWritable(method.getReturnType(), value);

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java?rev=639359&r1=639358&r2=639359&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/ipc/metrics/RpcMetrics.java Thu Mar 20 10:06:02
2008
@@ -27,6 +27,9 @@
 import org.apache.hadoop.metrics.jvm.JvmMetrics;
 import org.apache.hadoop.metrics.util.MetricsTimeVaryingRate;
 
+import java.util.HashMap;
+import java.util.*;
+
 /**
  * 
  * This class is for maintaining  the various RPC statistics
@@ -69,6 +72,9 @@
   public MetricsTimeVaryingRate rpcQueueTime = new MetricsTimeVaryingRate("RpcQueueTime");
   public MetricsTimeVaryingRate rpcProcessingTime = new MetricsTimeVaryingRate("RpcProcessingTime");
   public MetricsTimeVaryingRate rpcDiscardedOps = new MetricsTimeVaryingRate("RpcDiscardedOps");
+
+  public Map <String, MetricsTimeVaryingRate> metricsList = Collections.synchronizedMap(new
HashMap<String, MetricsTimeVaryingRate>());
+
   
   
   /**
@@ -78,7 +84,20 @@
     rpcQueueTime.pushMetric(metricsRecord);
     rpcProcessingTime.pushMetric(metricsRecord);
     rpcDiscardedOps.pushMetric(metricsRecord);
-    
+
+    synchronized (metricsList) {
+	// Iterate through the rpcMetrics hashmap to propogate the different rpc metrics.
+	Set keys = metricsList.keySet();
+
+	Iterator keyIter = keys.iterator();
+
+	while (keyIter.hasNext()) {
+		Object key = keyIter.next();
+		MetricsTimeVaryingRate value = metricsList.get(key);
+
+		value.pushMetric(metricsRecord);
+	}
+    }
   }
 
   public void shutdown() {



Mime
View raw message