YARN-1923. Make Fair Scheduler resource ratio calculations terminate faster (Anubhav Dhoot via Sandy Ryza)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1586796 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sanford Ryza 2014-04-11 23:24:40 +00:00
parent 2f72888896
commit 9274626a11
2 changed files with 9 additions and 2 deletions

View File

@ -50,6 +50,9 @@ Release 2.5.0 - UNRELEASED
YARN-1889. In Fair Scheduler, avoid creating objects on each call to
AppSchedulable comparator (Hong Zhiguo via Sandy Ryza)
YARN-1923. Make Fair Scheduler resource ratio calculations terminate faster
(Anubhav Dhoot via Sandy Ryza)
OPTIMIZATIONS
BUG FIXES

View File

@ -107,8 +107,12 @@ public static void computeShares(
double right = rMax;
for (int i = 0; i < COMPUTE_FAIR_SHARES_ITERATIONS; i++) {
double mid = (left + right) / 2.0;
if (resourceUsedWithWeightToResourceRatio(mid, schedulables, type) <
totalResource) {
int plannedResourceUsed = resourceUsedWithWeightToResourceRatio(
mid, schedulables, type);
if (plannedResourceUsed == totalResource) {
right = mid;
break;
} else if (plannedResourceUsed < totalResource) {
left = mid;
} else {
right = mid;