Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
Description
As part of the fair share assignment, fair scheduler needs to sort queues to decide which queue is furthest away from its fair share. During the sorting, the comparator needs to get the Resource usage of each queue.
The parent queue will aggregate the resource usage from leaf queues. The leaf queue will aggregate the resource usage from all apps in the queue.
FSLeafQueue.java @Override public Resource getResourceUsage() { Resource usage = Resources.createResource(0); readLock.lock(); try { for (FSAppAttempt app : runnableApps) { Resources.addTo(usage, app.getResourceUsage()); } for (FSAppAttempt app : nonRunnableApps) { Resources.addTo(usage, app.getResourceUsage()); } } finally { readLock.unlock(); } return usage; }
Each time fair scheduler tries to assign a container, it needs to sort all queues. Thus the number of Resources.addTo operations will be (number_of_queues) * lg(number_of_queues) * number_of_apps_per_queue, or number_of_apps_on_the_cluster * lg(number_of_queues).
One way to solve this is to cache the resource usage at FSLeafQueue level. Each time fair scheduler updates FSAppAttempt's resource usage, it will update FSLeafQueue resource usage. This will greatly reduce the overall number of Resources.addTo operations.
Attachments
Issue Links
- duplicates
-
YARN-4090 Make Collections.sort() more efficient by caching resource usage
- Resolved