Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1330307

Summary: product API call with 'enabled=true' slow, causing product page to load slowly
Product: Red Hat Satellite Reporter: Adam Price <adprice>
Component: PerformanceAssignee: Adam Price <adprice>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, cduryee, cwelton, mmccune, oprazak, peter.vreman, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14259
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.27-1,rubygem-katello-3.0.0.34-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:40:19 UTC Type: ---
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: 1122832    
Attachments:
Description Flags
Product page listing performance none

Description Adam Price 2016-04-25 20:38:56 UTC
The product listing page takes about 5-7 seconds to load with 10 custom products and 7 RH products enabled.

It looks like the 'enabled=true' flag when calling the products API has something to do with this. For example:

<pre>
# time curl -sk 'https://admin:changeme@localhost/katello/api/products?organization_id=3&page=1&paged=true&search=&sort_by=name&sort_order=ASC' > /dev/null

real    0m1.853s
user    0m0.034s
sys     0m0.024s

# time curl -sk 'https://admin:changeme@localhost/katello/api/products?enabled=true&organization_id=3&page=1&paged=true&search=&sort_by=name&sort_order=ASC' > /dev/null

real    0m4.246s
user    0m0.024s
sys     0m0.028s

</pre>

There is a 'self.enabled' method on the product model that may need investigation.

Comment 1 Adam Price 2016-04-25 20:38:58 UTC
Created from redmine issue http://projects.theforeman.org/issues/14259

Comment 2 Adam Price 2016-04-25 20:39:00 UTC
Upstream bug assigned to adprice

Comment 4 Bryan Kearney 2016-04-28 16:17:57 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14259 has been closed

Comment 6 Adam Price 2016-05-17 17:59:31 UTC
second PR [1] merged to katello master.

[1] https://github.com/Katello/katello/pull/6012

Comment 7 Chris Duryee 2016-05-26 18:28:58 UTC
*** Bug 1271160 has been marked as a duplicate of this bug. ***

Comment 8 Ondřej Pražák 2016-05-31 07:28:39 UTC
Created attachment 1163060 [details]
Product page listing performance

enabled=true does not seem to have a negative impact on performance when listing products any more.
Verified on RHEL 7, snap 13.1

Comment 9 Peter Vreman 2016-06-08 12:34:54 UTC
The patch works for me and reduces the time by 2.5 times. But it is still > 5 seconds that is expected to list 30 products as set on the expectation in the the marked as duplicate BZ1271160

Before the Patch:

[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/organizations/3/products | jq .total
36

real    0m20.379s
user    0m0.184s
sys     0m0.060s

After the Patch:

[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/organizations/3/products | jq .total
36

real    0m8.492s
user    0m0.192s
sys     0m0.047s

Comment 10 Peter Vreman 2016-06-08 12:41:49 UTC
The above test was with https://patch-diff.githubusercontent.com/raw/Katello/katello/pull/5991.diff applied.

Now with also https://patch-diff.githubusercontent.com/raw/Katello/katello/pull/6012.diff is is slightly better, but still > 5 seconds:

[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/organizations/3/products | jq .total
36

real    0m6.724s
user    0m0.185s
sys     0m0.051s


It is visible that with PR6012 applied that size is reduced from 24860 to 14216 bytes:

Without PR6012:
[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/organizations/3/products | wc -c
24860

real    0m7.374s
user    0m0.181s
sys     0m0.057s

With PR6012:
[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999}" -XGET https://localhost/katello/api/v2/organizations/3/products | wc -c
14216

real    0m6.348s
user    0m0.180s
sys     0m0.052s

Comment 11 Bryan Kearney 2016-07-27 11:40:19 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.

https://access.redhat.com/errata/RHBA-2016:1501