From 51881535e659940b1b332d0c5952ee1f9958cc7f Mon Sep 17 00:00:00 2001 From: Robert Kanter Date: Mon, 12 Jan 2015 17:51:00 -0800 Subject: [PATCH] YARN-2643. Don't create a new DominantResourceCalculator on every FairScheduler.allocate call. (kasha via rkanter) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../resourcemanager/scheduler/fair/FairScheduler.java | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index f8499603db..0afc4cf735 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -180,6 +180,9 @@ Release 2.7.0 - UNRELEASED YARN-2957. Create unit test to automatically compare YarnConfiguration and yarn-default.xml. (rchiang via rkanter) + YARN-2643. Don't create a new DominantResourceCalculator on every + FairScheduler.allocate call. (kasha via rkanter) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java index 2f0857e18f..1ace6040b2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FairScheduler.java @@ -127,6 +127,8 @@ public class FairScheduler extends private static final ResourceCalculator RESOURCE_CALCULATOR = new DefaultResourceCalculator(); + private static final ResourceCalculator DOMINANT_RESOURCE_CALCULATOR = + new DominantResourceCalculator(); // Value that container assignment methods return when a container is // reserved @@ -878,7 +880,8 @@ private synchronized void removeNode(RMNode rmNode) { @Override public Allocation allocate(ApplicationAttemptId appAttemptId, - List ask, List release, List blacklistAdditions, List blacklistRemovals) { + List ask, List release, + List blacklistAdditions, List blacklistRemovals) { // Make sure this application exists FSAppAttempt application = getSchedulerApp(appAttemptId); @@ -889,7 +892,7 @@ public Allocation allocate(ApplicationAttemptId appAttemptId, } // Sanity check - SchedulerUtils.normalizeRequests(ask, new DominantResourceCalculator(), + SchedulerUtils.normalizeRequests(ask, DOMINANT_RESOURCE_CALCULATOR, clusterResource, minimumAllocation, getMaximumResourceCapability(), incrAllocation);