Bug 976089

Summary: finding systems consuming a subscription very slow
Product: [Retired] Subscription Asset Manager Reporter: Tom McKay <tomckay>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: Tazim Kolhar <tkolhar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.3CC: bkearney, cwelton, sthirugn, tkolhar
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 995944 (view as bug list) Environment:
Last Closed: 2013-10-01 10:58:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 833466, 995944    
Attachments:
Description Flags
Subscriptions Unit none

Description Tom McKay 2013-06-19 21:05:42 UTC
https://github.com/Katello/katello/blob/master/app/models/glue/candlepin/consumer.rb?source=cc#L519

Entitlements from all_by_pool() and all_by_pool_id() gets all from entirety of candlepin, then reduces it to a specific pool id. This action has been seen to be very slow on a setup with several hundreds of subscriptions. Worse, if one org has a lot of entitlements, it will slow down all other orgs as well.

Possible optimizations:
+ limit entitlements to owner (org)
+ limit entitlements to pool id

The UI sees this slowness in the Subscription->Units tab

Comment 2 Bryan Kearney 2013-06-28 16:55:55 UTC
https://github.com/candlepin/candlepin/pull/306


Adds a new api which is /pools/{pool_id}/entitlements

Comment 3 Bryan Kearney 2013-07-01 14:06:37 UTC
commit 3fda508fb2007f4950d5c3b7b327353e3a650544
Author: Bryan Kearney <bkearney>
Date:   Fri Jun 28 12:53:32 2013 -0400

    976089: Expose new api to get entitlements for a pool
    
    This new API is at /pools/{pool_id}/entitlements. This API should be
    more performant then iterating over all the entitlements.

Comment 4 Bryan Kearney 2013-08-02 18:52:14 UTC
SNAP0 contains these bug fixes. Moving to ON_QA.

Comment 5 Tazim Kolhar 2013-08-13 07:59:36 UTC
Created attachment 786026 [details]
Subscriptions Unit

VERIFIED :

# rpm -qa | grep katello
katello-selinux-1.4.4-2.el6sat.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-common-1.4.3-5.el6sat.noarch
katello-cli-1.4.3-5.el6sat.noarch
katello-common-1.4.3-6.el6sam_splice.noarch
katello-configure-1.4.4-2.el6sat.noarch
katello-glue-elasticsearch-1.4.3-6.el6sam_splice.noarch
katello-headpin-all-1.4.3-6.el6sam_splice.noarch
katello-glue-candlepin-1.4.3-6.el6sam_splice.noarch
signo-katello-0.0.10-2.el6sat.noarch
katello-headpin-1.4.3-6.el6sam_splice.noarch

Comment 7 errata-xmlrpc 2013-10-01 10:58:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1390.html