MAPREDUCE-3897. Fixed computation of maxActiveAppsPerUser for queues by using capacity and not max-capacity since we are already scaling it by userLimitFactor. Contributed by Eric Payne.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1296898 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arun Murthy 2012-03-04 23:44:57 +00:00
parent d41cb76b56
commit 6d80dc2a84
3 changed files with 33 additions and 5 deletions

View File

@ -253,6 +253,10 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3960. Fix web-proxy to forward request to AM with configured MAPREDUCE-3960. Fix web-proxy to forward request to AM with configured
hostname or IP. (tgraves via acmurthy) hostname or IP. (tgraves via acmurthy)
MAPREDUCE-3897. Fixed computation of maxActiveAppsPerUser for queues by
using capacity and not max-capacity since we are already scaling it by
userLimitFactor. (Eric Payne via acmurthy)
Release 0.23.1 - 2012-02-17 Release 0.23.1 - 2012-02-17
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -88,7 +88,8 @@ public class LeafQueue implements CSQueue {
private int maxApplicationsPerUser; private int maxApplicationsPerUser;
private float maxAMResourcePercent; private float maxAMResourcePercent;
private int maxActiveApplications; private int maxActiveApplications; // Based on absolute max capacity
private int maxActiveAppsUsingAbsCap; // Based on absolute capacity
private int maxActiveApplicationsPerUser; private int maxActiveApplicationsPerUser;
private Resource usedResources = Resources.createResource(0); private Resource usedResources = Resources.createResource(0);
@ -167,8 +168,12 @@ public LeafQueue(CapacitySchedulerContext cs,
CSQueueUtils.computeMaxActiveApplications( CSQueueUtils.computeMaxActiveApplications(
cs.getClusterResources(), this.minimumAllocation, cs.getClusterResources(), this.minimumAllocation,
maxAMResourcePercent, absoluteMaxCapacity); maxAMResourcePercent, absoluteMaxCapacity);
this.maxActiveAppsUsingAbsCap =
CSQueueUtils.computeMaxActiveApplications(
cs.getClusterResources(), this.minimumAllocation,
maxAMResourcePercent, absoluteCapacity);
int maxActiveApplicationsPerUser = int maxActiveApplicationsPerUser =
CSQueueUtils.computeMaxActiveApplicationsPerUser(maxActiveApplications, userLimit, CSQueueUtils.computeMaxActiveApplicationsPerUser(maxActiveAppsUsingAbsCap, userLimit,
userLimitFactor); userLimitFactor);
this.queueInfo = recordFactory.newRecordInstance(QueueInfo.class); this.queueInfo = recordFactory.newRecordInstance(QueueInfo.class);
@ -271,6 +276,11 @@ private synchronized void setupQueueConfigs(
"(int)ceil((clusterResourceMemory / minimumAllocation) *" + "(int)ceil((clusterResourceMemory / minimumAllocation) *" +
"maxAMResourcePercent * absoluteMaxCapacity)," + "maxAMResourcePercent * absoluteMaxCapacity)," +
"1) ]" + "\n" + "1) ]" + "\n" +
"maxActiveAppsUsingAbsCap = " + maxActiveAppsUsingAbsCap +
" [= max(" +
"(int)ceil((clusterResourceMemory / minimumAllocation) *" +
"maxAMResourcePercent * absoluteCapacity)," +
"1) ]" + "\n" +
"maxActiveApplicationsPerUser = " + maxActiveApplicationsPerUser + "maxActiveApplicationsPerUser = " + maxActiveApplicationsPerUser +
" [= max(" + " [= max(" +
"(int)(maxActiveApplications * (userLimit / 100.0f) * " + "(int)(maxActiveApplications * (userLimit / 100.0f) * " +
@ -1376,9 +1386,13 @@ public synchronized void updateClusterResource(Resource clusterResource) {
CSQueueUtils.computeMaxActiveApplications( CSQueueUtils.computeMaxActiveApplications(
clusterResource, minimumAllocation, clusterResource, minimumAllocation,
maxAMResourcePercent, absoluteMaxCapacity); maxAMResourcePercent, absoluteMaxCapacity);
maxActiveAppsUsingAbsCap =
CSQueueUtils.computeMaxActiveApplications(
clusterResource, minimumAllocation,
maxAMResourcePercent, absoluteCapacity);
maxActiveApplicationsPerUser = maxActiveApplicationsPerUser =
CSQueueUtils.computeMaxActiveApplicationsPerUser( CSQueueUtils.computeMaxActiveApplicationsPerUser(
maxActiveApplications, userLimit, userLimitFactor); maxActiveAppsUsingAbsCap, userLimit, userLimitFactor);
// Update metrics // Update metrics
CSQueueUtils.updateQueueStatistics( CSQueueUtils.updateQueueStatistics(

View File

@ -158,9 +158,14 @@ public void testLimitsComputation() throws Exception {
queue.getAbsoluteMaximumCapacity())); queue.getAbsoluteMaximumCapacity()));
assertEquals(expectedMaxActiveApps, assertEquals(expectedMaxActiveApps,
queue.getMaximumActiveApplications()); queue.getMaximumActiveApplications());
int expectedMaxActiveAppsUsingAbsCap =
Math.max(1,
(int)Math.ceil(((float)clusterResource.getMemory() / (1*GB)) *
csConf.getMaximumApplicationMasterResourcePercent() *
queue.getAbsoluteCapacity()));
assertEquals( assertEquals(
(int)Math.ceil( (int)Math.ceil(
expectedMaxActiveApps * (queue.getUserLimit() / 100.0f) * expectedMaxActiveAppsUsingAbsCap * (queue.getUserLimit() / 100.0f) *
queue.getUserLimitFactor()), queue.getUserLimitFactor()),
queue.getMaximumActiveApplicationsPerUser()); queue.getMaximumActiveApplicationsPerUser());
assertEquals( assertEquals(
@ -178,8 +183,13 @@ public void testLimitsComputation() throws Exception {
queue.getAbsoluteMaximumCapacity())); queue.getAbsoluteMaximumCapacity()));
assertEquals(expectedMaxActiveApps, assertEquals(expectedMaxActiveApps,
queue.getMaximumActiveApplications()); queue.getMaximumActiveApplications());
expectedMaxActiveAppsUsingAbsCap =
Math.max(1,
(int)Math.ceil(((float)clusterResource.getMemory() / (1*GB)) *
csConf.getMaximumApplicationMasterResourcePercent() *
queue.getAbsoluteCapacity()));
assertEquals( assertEquals(
(int)Math.ceil(expectedMaxActiveApps * (int)Math.ceil(expectedMaxActiveAppsUsingAbsCap *
(queue.getUserLimit() / 100.0f) * queue.getUserLimitFactor()), (queue.getUserLimit() / 100.0f) * queue.getUserLimitFactor()),
queue.getMaximumActiveApplicationsPerUser()); queue.getMaximumActiveApplicationsPerUser());
assertEquals( assertEquals(