Bug 1330307 - product API call with 'enabled=true' slow, causing product page to load slowly
Summary: product API call with 'enabled=true' slow, causing product page to load slowly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Performance
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Adam Price
QA Contact:
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1271160 (view as bug list)
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2016-04-25 20:38 UTC by Adam Price
Modified: 2019-09-26 18:41 UTC (History)
7 users (show)

Fixed In Version: rubygem-katello-3.0.0.27-1,rubygem-katello-3.0.0.34-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:40:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Product page listing performance (30.96 KB, image/png)
2016-05-31 07:28 UTC, Ondřej Pražák
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14259 0 None None None 2016-04-25 21:04:34 UTC

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


Note You need to log in before you can comment on or make changes to this bug.