candlepin/candlepin — pull request #799 by dgoodwin (2014-12-16 20:10:16+00:00)
Title: 1171781: Major performance improvements for list owner pools.

With large numbers of pools (~1600) and a consumer with many entitlements
(~350), list owner pools was taking ~50s when filtering for pools applicable
for a specific consumer.

The problem resulted from the use of two rules classes, Entitlement and
Quantity. Each was called once per pool (1600 times), and serializing the
consumer's entitlements each time. (minus the actual entitlement certificate
blob thankfully)

Brought back an old approach for entitlement rules where we make one rules call
to filter all pools. This was backed out in
c7d65e7a6eb9f485959facaf8b19d4a3577a409b for memory usage reasons, but those
were not spawned by any particular bug or error only observation. In the above
scenario, the JSON context is about 3.5mb.

Pursued a similar approach for QuantityRules where we only make one call for
all pools.

End result is about 4s for the same list pools operation, virtually
indistinguishable from the API call without consumer filtering (no rules). The
time is spent serializing the JSON response, about 6.3mb.

This PR is against the 0.9.26-hotfix branch where we need to release this. I'll merge it to master manually after, and also bump the rules version in master again as this one is equal to what we have in master atm.