Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-4691

Cache resource usage at FSLeafQueue level

    XMLWordPrintableJSON

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

          Activity

            People

              yufeigu Yufei Gu
              mingma Ming Ma
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: