hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r780953 - in /hadoop/core/trunk: ./ src/mapred/ src/mapred/org/apache/hadoop/mapred/ src/test/mapred/org/apache/hadoop/mapred/
Date Tue, 02 Jun 2009 06:51:50 GMT
Author: ddas
Date: Tue Jun  2 06:51:49 2009
New Revision: 780953

URL: http://svn.apache.org/viewvc?rev=780953&view=rev
Log:
HADOOP-5784. Makes the number of heartbeats that should arrive a second at the JobTracker
configurable. Contributed by Amareshwari Sriramadasu.

Added:
    hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestMapredHeartbeat.java
Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/mapred/mapred-default.xml
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java
    hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MRConstants.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=780953&r1=780952&r2=780953&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Jun  2 06:51:49 2009
@@ -414,6 +414,9 @@
     HADOOP-5696. Change org.apache.hadoop.examples.Sort to use new 
     mapreduce api. (Amareshwari Sriramadasu via sharad)
 
+    HADOOP-5784. Makes the number of heartbeats that should arrive a second
+    at the JobTracker configurable. (Amareshwari Sriramadasu via ddas)
+
   OPTIMIZATIONS
 
     HADOOP-5595. NameNode does not need to run a replicator to choose a

Modified: hadoop/core/trunk/src/mapred/mapred-default.xml
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/mapred-default.xml?rev=780953&r1=780952&r2=780953&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/mapred-default.xml (original)
+++ hadoop/core/trunk/src/mapred/mapred-default.xml Tue Jun  2 06:51:49 2009
@@ -654,6 +654,15 @@
 </property>
 
 <property>
+  <name>mapred.heartbeats.in.second</name>
+  <value>100</value>
+  <description>Expert: Approximate number of heart-beats that could arrive 
+               JobTracker in a second. Assuming each RPC can be processed 
+               in 10msec, the default value is made 100 RPCs in a second.
+  </description>
+</property> 
+
+<property>
   <name>mapred.max.tracker.blacklists</name>
   <value>4</value>
   <description>The number of blacklists for a taskTracker by various jobs

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java?rev=780953&r1=780952&r2=780953&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/JobTracker.java Tue Jun  2 06:51:49
2009
@@ -116,6 +116,9 @@
   // The maximum number of blacklists for a tracker after which the 
   // tracker could be blacklisted across all jobs
   private int MAX_BLACKLISTS_PER_TRACKER = 4;
+  // Approximate number of heartbeats that could arrive JobTracker
+  // in a second
+  private int NUM_HEARTBEATS_IN_SECOND = 100;
   public static enum State { INITIALIZING, RUNNING }
   State state = State.INITIALIZING;
   private static final int SYSTEM_DIR_CLEANUP_RETRY_PERIOD = 10000;
@@ -1561,6 +1564,8 @@
     MAX_COMPLETE_USER_JOBS_IN_MEMORY = conf.getInt("mapred.jobtracker.completeuserjobs.maximum",
100);
     MAX_BLACKLISTS_PER_TRACKER = 
         conf.getInt("mapred.max.tracker.blacklists", 4);
+    NUM_HEARTBEATS_IN_SECOND = 
+        conf.getInt("mapred.heartbeats.in.second", 100);
 
     //This configuration is there solely for tuning purposes and 
     //once this feature has been tested in real clusters and an appropriate
@@ -2674,7 +2679,7 @@
     int clusterSize = getClusterStatus().getTaskTrackers();
     int heartbeatInterval =  Math.max(
                                 (int)(1000 * Math.ceil((double)clusterSize / 
-                                                       CLUSTER_INCREMENT)),
+                                                       NUM_HEARTBEATS_IN_SECOND)),
                                 HEARTBEAT_INTERVAL_MIN) ;
     return heartbeatInterval;
   }

Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MRConstants.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MRConstants.java?rev=780953&r1=780952&r2=780953&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MRConstants.java (original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/MRConstants.java Tue Jun  2 06:51:49
2009
@@ -27,8 +27,6 @@
   //
   public static final int HEARTBEAT_INTERVAL_MIN = 3 * 1000;
   
-  public static final int CLUSTER_INCREMENT = 100;
-
   public static final long COUNTER_UPDATE_INTERVAL = 60 * 1000;
 
   //

Added: hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestMapredHeartbeat.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestMapredHeartbeat.java?rev=780953&view=auto
==============================================================================
--- hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestMapredHeartbeat.java (added)
+++ hadoop/core/trunk/src/test/mapred/org/apache/hadoop/mapred/TestMapredHeartbeat.java Tue
Jun  2 06:51:49 2009
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.mapred;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.hadoop.mapred.JobConf;
+
+public class TestMapredHeartbeat extends TestCase {
+  public void testJobDirCleanup() throws IOException {
+    MiniMRCluster mr = null;
+    try {
+      // test the default heartbeat interval
+      int taskTrackers = 2;
+      JobConf conf = new JobConf();
+      mr = new MiniMRCluster(taskTrackers, "file:///", 3, 
+          null, null, conf);
+      JobClient jc = new JobClient(mr.createJobConf());
+      while(jc.getClusterStatus().getTaskTrackers() != taskTrackers) {
+        UtilsForTests.waitFor(100);
+      }
+      assertEquals(MRConstants.HEARTBEAT_INTERVAL_MIN, 
+        mr.getJobTrackerRunner().getJobTracker().getNextHeartbeatInterval());
+      mr.shutdown(); 
+      
+      // test configured heartbeat interval
+      taskTrackers = 5;
+      conf.setInt("mapred.heartbeats.in.second", 1);
+      mr = new MiniMRCluster(taskTrackers, "file:///", 3, 
+          null, null, conf);
+      jc = new JobClient(mr.createJobConf());
+      while(jc.getClusterStatus().getTaskTrackers() != taskTrackers) {
+        UtilsForTests.waitFor(100);
+      }
+      assertEquals(taskTrackers * 1000, 
+        mr.getJobTrackerRunner().getJobTracker().getNextHeartbeatInterval());
+      mr.shutdown(); 
+      
+      // test configured heartbeat interval is capped with min value
+      taskTrackers = 5;
+      conf.setInt("mapred.heartbeats.in.second", 10);
+      mr = new MiniMRCluster(taskTrackers, "file:///", 3, 
+          null, null, conf);
+      jc = new JobClient(mr.createJobConf());
+      while(jc.getClusterStatus().getTaskTrackers() != taskTrackers) {
+        UtilsForTests.waitFor(100);
+      }
+      assertEquals(MRConstants.HEARTBEAT_INTERVAL_MIN, 
+        mr.getJobTrackerRunner().getJobTracker().getNextHeartbeatInterval());
+    } finally {
+      if (mr != null) { mr.shutdown(); }
+    }
+  }
+}
+
+



Mime
View raw message