Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-7150

Optimize collections used by MR JHS to reduce its memory

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.0
    • Component/s: jobhistoryserver, mrv2
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      We analyzed, using jxray (www.jxray.com) a heap dump of JHS running with big heap in a large clusters, handling large MapReduce jobs. The heap is large (over 32GB) and 21.4% of it is wasted due to various suboptimal Java collections, mostly maps and lists that are either empty or contain only one element. In such under-populated collections considerable amount of memory is still used by just the internal implementation objects. See the attached excerpt from the jxray report for the details. If certain collections are almost always empty, they should be initialized lazily. If others almost always have just 1 or 2 elements, they should be initialized with the appropriate initial capacity of 1 or 2 (the default capacity is 16 for HashMap and 10 for ArrayList).

      Based on the attached report, we should do the following:

      1. FileSystemCounterGroup.map - initialize lazily
      2. CompletedTask.attempts - initialize with  capacity 2, given most tasks only have one or two attempts
      3. JobHistoryParser$TaskInfo.attemptsMap - initialize with capacity
      4. CompletedTaskAttempt.diagnostics - initialize with capacity 1 since it contains one diagnostic message most of the time
      5. CompletedTask.reportDiagnostics - switch to ArrayList (no reason to use the more wasteful LinkedList here) and initialize with capacity 1.

        Attachments

        1. YARN-8872.04.patch
          9 kB
          Misha Dmitriev
        2. YARN-8872.03.patch
          9 kB
          Misha Dmitriev
        3. YARN-8872.02.patch
          9 kB
          Misha Dmitriev
        4. YARN-8872.01.patch
          9 kB
          Misha Dmitriev
        5. jhs-bad-collections.png
          504 kB
          Misha Dmitriev

          Activity

            People

            • Assignee:
              misha@cloudera.com Misha Dmitriev
              Reporter:
              misha@cloudera.com Misha Dmitriev
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: