Author: omalley
Date: Fri Aug 8 16:35:46 2008
New Revision: 684142
URL: http://svn.apache.org/viewvc?rev=684142&view=rev
Log:
HADOOP-3875. Change the time period between heartbeats to be relative to
the end of the heartbeat rpc, rather than the start. This causes better
behavior if the JobTracker is overloaded. (acmurthy via omalley)
Modified:
hadoop/core/trunk/CHANGES.txt
hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
Modified: hadoop/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=684142&r1=684141&r2=684142&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Aug 8 16:35:46 2008
@@ -148,6 +148,10 @@
HADOOP-3892. Include unix group name in JobConf. (Matei Zaharia via johan)
+ HADOOP-3875. Change the time period between heartbeats to be relative to
+ the end of the heartbeat rpc, rather than the start. This causes better
+ behavior if the JobTracker is overloaded. (acmurthy via omalley)
+
OPTIMIZATIONS
HADOOP-3556. Removed lock contention in MD5Hash by changing the
Modified: hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
URL:
http://svn.apache.org/viewvc/hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java?rev=684142&r1=684141&r2=684142&view=diff
==============================================================================
--- hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java
(original)
+++ hadoop/core/trunk/src/mapred/org/apache/hadoop/mapred/TaskTracker.java Fri
Aug 8 16:35:46 2008
@@ -909,7 +909,12 @@
}
// Send the heartbeat and process the jobtracker's directives
- HeartbeatResponse heartbeatResponse = transmitHeartBeat();
+ HeartbeatResponse heartbeatResponse = transmitHeartBeat(now);
+
+ // Note the time when the heartbeat returned, use this to decide when
to send the
+ // next heartbeat
+ lastHeartbeat = System.currentTimeMillis();
+
TaskTrackerAction[] actions = heartbeatResponse.getActions();
if(LOG.isDebugEnabled()) {
LOG.debug("Got heartbeatResponse from JobTracker with responseId: "
+
@@ -920,7 +925,6 @@
return State.STALE;
}
- lastHeartbeat = now;
// resetting heartbeat interval from the response.
heartbeatInterval = heartbeatResponse.getHeartbeatInterval();
justStarted = false;
@@ -972,12 +976,12 @@
/**
* Build and transmit the heart beat to the JobTracker
+ * @param now current time
* @return false if the tracker was unknown
* @throws IOException
*/
- private HeartbeatResponse transmitHeartBeat() throws IOException {
+ private HeartbeatResponse transmitHeartBeat(long now) throws IOException {
// Send Counters in the status once every COUNTER_UPDATE_INTERVAL
- long now = System.currentTimeMillis();
boolean sendCounters;
if (now > (previousUpdate + COUNTER_UPDATE_INTERVAL)) {
sendCounters = true;