YARN-8212. Pending backlog for async allocation threads should be configurable. Contributed by Tao Yang.
(cherry picked from commit 2d319e3793
)
This commit is contained in:
parent
0fc55a8f57
commit
f34f4e9c11
|
@ -260,6 +260,7 @@ public class CapacityScheduler extends
|
|||
CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_PREFIX
|
||||
+ ".scheduling-interval-ms";
|
||||
private static final long DEFAULT_ASYNC_SCHEDULER_INTERVAL = 5;
|
||||
private long asyncMaxPendingBacklogs;
|
||||
|
||||
public CapacityScheduler() {
|
||||
super(CapacityScheduler.class.getName());
|
||||
|
@ -377,6 +378,11 @@ public class CapacityScheduler extends
|
|||
asyncSchedulerThreads.add(new AsyncScheduleThread(this));
|
||||
}
|
||||
resourceCommitterService = new ResourceCommitterService(this);
|
||||
asyncMaxPendingBacklogs = this.conf.getInt(
|
||||
CapacitySchedulerConfiguration.
|
||||
SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_PENDING_BACKLOGS,
|
||||
CapacitySchedulerConfiguration.
|
||||
DEFAULT_SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_PENDING_BACKLOGS);
|
||||
}
|
||||
|
||||
// Setup how many containers we can allocate for each round
|
||||
|
@ -571,7 +577,8 @@ public class CapacityScheduler extends
|
|||
Thread.sleep(100);
|
||||
} else {
|
||||
// Don't run schedule if we have some pending backlogs already
|
||||
if (cs.getAsyncSchedulingPendingBacklogs() > 100) {
|
||||
if (cs.getAsyncSchedulingPendingBacklogs()
|
||||
> cs.asyncMaxPendingBacklogs) {
|
||||
Thread.sleep(1);
|
||||
} else{
|
||||
schedule(cs);
|
||||
|
|
|
@ -244,6 +244,14 @@ public class CapacitySchedulerConfiguration extends ReservationSchedulerConfigur
|
|||
public static final String SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_THREAD =
|
||||
SCHEDULE_ASYNCHRONOUSLY_PREFIX + ".maximum-threads";
|
||||
|
||||
@Private
|
||||
public static final String SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_PENDING_BACKLOGS =
|
||||
SCHEDULE_ASYNCHRONOUSLY_PREFIX + ".maximum-pending-backlogs";
|
||||
|
||||
@Private
|
||||
public static final Integer
|
||||
DEFAULT_SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_PENDING_BACKLOGS = 100;
|
||||
|
||||
@Private
|
||||
public static final boolean DEFAULT_SCHEDULE_ASYNCHRONOUSLY_ENABLE = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue