YARN-4690. Skip object allocation in FSAppAttempt#getResourceUsage when possible (Ming Ma via sjlee)
(cherry picked from commit 7de70680fe
)
This commit is contained in:
parent
5ff2012f64
commit
3a8c7ffeb4
|
@ -2147,6 +2147,9 @@ Release 2.6.5 - UNRELEASED
|
|||
|
||||
OPTIMIZATIONS
|
||||
|
||||
YARN-4690. Skip object allocation in FSAppAttempt#getResourceUsage when
|
||||
possible (Ming Ma via sjlee)
|
||||
|
||||
BUG FIXES
|
||||
|
||||
Release 2.6.4 - 2016-02-11
|
||||
|
|
|
@ -865,7 +865,12 @@ public class FSAppAttempt extends SchedulerApplicationAttempt
|
|||
public Resource getResourceUsage() {
|
||||
// Here the getPreemptedResources() always return zero, except in
|
||||
// a preemption round
|
||||
return Resources.subtract(getCurrentConsumption(), getPreemptedResources());
|
||||
// In the common case where preempted resource is zero, return the
|
||||
// current consumption Resource object directly without calling
|
||||
// Resources.subtract which creates a new Resource object for each call.
|
||||
return getPreemptedResources().equals(Resources.none()) ?
|
||||
getCurrentConsumption() :
|
||||
Resources.subtract(getCurrentConsumption(), getPreemptedResources());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue