YARN-2323. FairShareComparator creates too many Resource objects (Hong Zhiguo via Sandy Ryza)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1612187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8871d8ed9f
commit
7c71a3b876
@ -51,6 +51,9 @@ Release 2.6.0 - UNRELEASED
|
||||
|
||||
YARN-2208. AMRMTokenManager need to have a way to roll over AMRMToken. (xgong)
|
||||
|
||||
YARN-2323. FairShareComparator creates too many Resource objects (Hong Zhiguo
|
||||
via Sandy Ryza)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
@ -65,6 +65,7 @@ public String getName() {
|
||||
private static class FairShareComparator implements Comparator<Schedulable>,
|
||||
Serializable {
|
||||
private static final long serialVersionUID = 5564969375856699313L;
|
||||
private static final Resource ONE = Resources.createResource(1);
|
||||
|
||||
@Override
|
||||
public int compare(Schedulable s1, Schedulable s2) {
|
||||
@ -78,11 +79,10 @@ public int compare(Schedulable s1, Schedulable s2) {
|
||||
s1.getResourceUsage(), minShare1);
|
||||
boolean s2Needy = Resources.lessThan(RESOURCE_CALCULATOR, null,
|
||||
s2.getResourceUsage(), minShare2);
|
||||
Resource one = Resources.createResource(1);
|
||||
minShareRatio1 = (double) s1.getResourceUsage().getMemory()
|
||||
/ Resources.max(RESOURCE_CALCULATOR, null, minShare1, one).getMemory();
|
||||
/ Resources.max(RESOURCE_CALCULATOR, null, minShare1, ONE).getMemory();
|
||||
minShareRatio2 = (double) s2.getResourceUsage().getMemory()
|
||||
/ Resources.max(RESOURCE_CALCULATOR, null, minShare2, one).getMemory();
|
||||
/ Resources.max(RESOURCE_CALCULATOR, null, minShare2, ONE).getMemory();
|
||||
useToWeightRatio1 = s1.getResourceUsage().getMemory() /
|
||||
s1.getWeights().getWeight(ResourceType.MEMORY);
|
||||
useToWeightRatio2 = s2.getResourceUsage().getMemory() /
|
||||
|
Loading…
Reference in New Issue
Block a user