Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-5384

OM refreshPipeline should not invoke the expensive OmKeyLocationInfoGroup.getLocationList()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • None
    • 1.2.0
    • OM

    Description

      The OM's refreshPipeline (used by liststatus) implementation iterates over OmKeyLocationInfoGroup.getLocationList(), which is a very expensive call. It iterate over a collection of list of objects, allocates a new list, perform operations on each of them. In short, it's an O( n ) method in terms of space and time complexity.

      There are many places in the Ozone code that uses this method. Most usages iterates over the generated list, without modifying the list. We should instead return the collection of lists, which is O( 1 ).

      I have a client that issues many listStatus calls to examine the effect. Before the change, refreshPipeline costs 8.65% of heap usage. After: 1.95%.
      CPU cost: before: 8.18% after: 4.22%

      We should refrain from invoking getLocationList() as much as possible. But given the wide usage in the code, I elect not to remove the usage completely to avoid destabilizing it. Instead, I changed the usage in refreshPipeline to demonstrate its impact.

      Attachments

        1. om_liststatus_cpu_after.svg
          477 kB
          Wei-Chiu Chuang
        2. om_liststatus_alloc_before.svg
          254 kB
          Wei-Chiu Chuang
        3. om_liststatus_cpu_before.svg
          474 kB
          Wei-Chiu Chuang
        4. om_listatus_alloc_after.svg
          253 kB
          Wei-Chiu Chuang

        Issue Links

          Activity

            People

              weichiu Wei-Chiu Chuang
              weichiu Wei-Chiu Chuang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: