Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2160

Improve performance of static methods in SubscriptionDefinition

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • True
    • 5

      Refactor some static methods of SubscriptionDefinition like "lookupSubscriptionByEngId" or "lookupSubscriptionByRole". These methods are being called many times in some workflows like the org-host synchronization (fact normalizer) and it takes around the 15% of the CPU time of the whole process:

      The main problem of these problems is that the big O complexity is always N^2*M (we need to loop over the subscriptions (N) twice and for each one, we need to loop over the variants (M)). And then the consumer of these methods need to loop over the variants again to get the product tag.

      There are several approaches to fix the above. One is to use map collections to map tags by engId and tags by role. On the other hand, this implies more memory usage, but we could use weak references and reload these maps as needed.

      Acceptance Criteria

      • Refactor unless the methods lookupSubscriptionByEngId and lookupSubscriptionByRole to reduce the big O complexity to N or 1 (using map collections).
      • QE is interested in the solution that is found even though it won't affect their tests
      • The CPU & memory usage should be validated using a profiler tool. 

              awood1@redhat.com Alex Wood
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: