YARN-2643. Don't create a new DominantResourceCalculator on every FairScheduler.allocate call. (kasha via rkanter)

(cherry picked from commit 51881535e6)
This commit is contained in:
Robert Kanter 2015-01-12 17:51:00 -08:00
parent 6e2eb9d5cf
commit 13cdcf28e0
2 changed files with 8 additions and 2 deletions

View File

@ -146,6 +146,9 @@ Release 2.7.0 - UNRELEASED
YARN-2957. Create unit test to automatically compare YarnConfiguration YARN-2957. Create unit test to automatically compare YarnConfiguration
and yarn-default.xml. (rchiang via rkanter) and yarn-default.xml. (rchiang via rkanter)
YARN-2643. Don't create a new DominantResourceCalculator on every
FairScheduler.allocate call. (kasha via rkanter)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -127,6 +127,8 @@ public class FairScheduler extends
private static final ResourceCalculator RESOURCE_CALCULATOR = private static final ResourceCalculator RESOURCE_CALCULATOR =
new DefaultResourceCalculator(); new DefaultResourceCalculator();
private static final ResourceCalculator DOMINANT_RESOURCE_CALCULATOR =
new DominantResourceCalculator();
// Value that container assignment methods return when a container is // Value that container assignment methods return when a container is
// reserved // reserved
@ -878,7 +880,8 @@ public class FairScheduler extends
@Override @Override
public Allocation allocate(ApplicationAttemptId appAttemptId, public Allocation allocate(ApplicationAttemptId appAttemptId,
List<ResourceRequest> ask, List<ContainerId> release, List<String> blacklistAdditions, List<String> blacklistRemovals) { List<ResourceRequest> ask, List<ContainerId> release,
List<String> blacklistAdditions, List<String> blacklistRemovals) {
// Make sure this application exists // Make sure this application exists
FSAppAttempt application = getSchedulerApp(appAttemptId); FSAppAttempt application = getSchedulerApp(appAttemptId);
@ -889,7 +892,7 @@ public class FairScheduler extends
} }
// Sanity check // Sanity check
SchedulerUtils.normalizeRequests(ask, new DominantResourceCalculator(), SchedulerUtils.normalizeRequests(ask, DOMINANT_RESOURCE_CALCULATOR,
clusterResource, minimumAllocation, getMaximumResourceCapability(), clusterResource, minimumAllocation, getMaximumResourceCapability(),
incrAllocation); incrAllocation);