YARN-7397. Reduce lock contention in FairScheduler#getAppWeight()
This commit is contained in:
parent
9c5c68745e
commit
e62bbbca7a
@ -369,19 +369,22 @@ public void update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getAppWeight(FSAppAttempt app) {
|
public float getAppWeight(FSAppAttempt app) {
|
||||||
try {
|
|
||||||
readLock.lock();
|
|
||||||
double weight = 1.0;
|
double weight = 1.0;
|
||||||
|
|
||||||
if (sizeBasedWeight) {
|
if (sizeBasedWeight) {
|
||||||
|
readLock.lock();
|
||||||
|
|
||||||
|
try {
|
||||||
// Set weight based on current memory demand
|
// Set weight based on current memory demand
|
||||||
weight = Math.log1p(app.getDemand().getMemorySize()) / Math.log(2);
|
weight = Math.log1p(app.getDemand().getMemorySize()) / Math.log(2);
|
||||||
}
|
|
||||||
return (float)weight * app.getPriority().getPriority();
|
|
||||||
} finally {
|
} finally {
|
||||||
readLock.unlock();
|
readLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (float)weight * app.getPriority().getPriority();
|
||||||
|
}
|
||||||
|
|
||||||
public Resource getIncrementResourceCapability() {
|
public Resource getIncrementResourceCapability() {
|
||||||
return incrAllocation;
|
return incrAllocation;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user