You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by rb...@apache.org on 2015/01/15 02:22:03 UTC

tez git commit: TEZ-1945. Remove 2 GB memlimit restriction in MergeManager (Rajesh Balamohan)

Repository: tez
Updated Branches:
  refs/heads/master adcfb84c5 -> 61bb0f8a0


TEZ-1945. Remove 2 GB memlimit restriction in MergeManager (Rajesh Balamohan)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/61bb0f8a
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/61bb0f8a
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/61bb0f8a

Branch: refs/heads/master
Commit: 61bb0f8a0af62eb34dfbc41c5ab6b43787449e48
Parents: adcfb84
Author: Rajesh Balamohan <rb...@hortonworks.com>
Authored: Thu Jan 15 06:51:54 2015 +0530
Committer: Rajesh Balamohan <rb...@hortonworks.com>
Committed: Thu Jan 15 06:51:54 2015 +0530

----------------------------------------------------------------------
 CHANGES.txt                                         |  1 +
 .../shuffle/impl/SimpleFetchedInputAllocator.java   |  4 +++-
 .../common/shuffle/orderedgrouped/MergeManager.java | 16 +++++++++++-----
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/61bb0f8a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ce4a9ac..97f9e1d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@ Release 0.7.0: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-1945. Remove 2 GB memlimit restriction in MergeManager.
   TEZ-1913. Reduce deserialize cost in ValuesIterator.
   TEZ-1917. Examples should extend TezExampleBase.
   TEZ-1892. Add hashCode and equals for Vertex/VertexGroup/Edge/GroupInputEdge.

http://git-wip-us.apache.org/repos/asf/tez/blob/61bb0f8a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/SimpleFetchedInputAllocator.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/SimpleFetchedInputAllocator.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/SimpleFetchedInputAllocator.java
index 7e568f9..7a8a95a 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/SimpleFetchedInputAllocator.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/impl/SimpleFetchedInputAllocator.java
@@ -104,7 +104,9 @@ public class SimpleFetchedInputAllocator implements FetchedInputAllocator,
           + singleShuffleMemoryLimitPercent);
     }
 
-    this.maxSingleShuffleLimit = (long) (memoryLimit * singleShuffleMemoryLimitPercent);
+    //TODO: cap it to MAX_VALUE until MemoryFetchedInput can handle > 2 GB
+    this.maxSingleShuffleLimit = (long) Math.min((memoryLimit * singleShuffleMemoryLimitPercent),
+        Integer.MAX_VALUE);
     
     LOG.info("SimpleInputManager -> " + "MemoryLimit: " + 
         this.memoryLimit + ", maxSingleMemLimit: " + this.maxSingleShuffleLimit);

http://git-wip-us.apache.org/repos/asf/tez/blob/61bb0f8a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/MergeManager.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/MergeManager.java b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/MergeManager.java
index aca7dc0..1524418 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/MergeManager.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/shuffle/orderedgrouped/MergeManager.java
@@ -193,8 +193,8 @@ public class MergeManager {
     }
 
     // Allow unit tests to fix Runtime memory
-    long memLimit = (long) (conf.getLong(Constants.TEZ_RUNTIME_TASK_MEMORY,
-        Math.min(inputContext.getTotalMemoryAvailableToTask(), Integer.MAX_VALUE)) * maxInMemCopyUse);
+    long memLimit = conf.getLong(Constants.TEZ_RUNTIME_TASK_MEMORY, (long)(inputContext
+        .getTotalMemoryAvailableToTask() * maxInMemCopyUse));
 
     float maxRedPer = conf.getFloat(TezRuntimeConfiguration.TEZ_RUNTIME_INPUT_POST_MERGE_BUFFER_PERCENT,
         TezRuntimeConfiguration.TEZ_RUNTIME_INPUT_BUFFER_PERCENT_DEFAULT);
@@ -238,8 +238,9 @@ public class MergeManager {
           + singleShuffleMemoryLimitPercent);
     }
 
+    //TODO: Cap it to MAX_VALUE until MapOutput starts supporting > 2 GB
     this.maxSingleShuffleLimit = 
-      (long)(memoryLimit * singleShuffleMemoryLimitPercent);
+        (long) Math.min((memoryLimit * singleShuffleMemoryLimitPercent), Integer.MAX_VALUE);
     this.memToMemMergeOutputsThreshold = 
             conf.getInt(
                 TezRuntimeConfiguration.TEZ_RUNTIME_SHUFFLE_MEMTOMEM_SEGMENTS, 
@@ -304,8 +305,8 @@ public class MergeManager {
       }
 
       // Allow unit tests to fix Runtime memory
-      long memLimit = (long) (conf.getLong(Constants.TEZ_RUNTIME_TASK_MEMORY,
-          Math.min(maxAvailableTaskMemory, Integer.MAX_VALUE)) * maxInMemCopyUse);
+      long memLimit = conf.getLong(Constants.TEZ_RUNTIME_TASK_MEMORY,
+          (long)(maxAvailableTaskMemory * maxInMemCopyUse));
       
       LOG.info("Initial Shuffle Memory Required: " + memLimit + ", based on INPUT_BUFFER_factor: " + maxInMemCopyUse);
 
@@ -332,9 +333,14 @@ public class MergeManager {
   }
 
   public synchronized void waitForShuffleToMergeMemory() throws InterruptedException {
+    long startTime = System.currentTimeMillis();
     while(usedMemory > memoryLimit) {
       wait();
     }
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Waited for " + (System.currentTimeMillis() - startTime) + " for memory to become"
+          + " available");
+    }
   }
 
   final private MapOutput stallShuffle = MapOutput.createWaitMapOutput(null);