Bug 1271221 - API Listing repositories slow, 24 repositories of redhat server product takes 30 seconds
API Listing repositories slow, 24 repositories of redhat server product takes...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Content Management (Show other bugs)
6.1.2
Unspecified Unspecified
unspecified Severity medium (vote)
: Beta
: --
Assigned To: Justin Sherrill
jcallaha
http://projects.theforeman.org/issues...
: Triaged
Depends On:
Blocks: 1122832
  Show dependency treegraph
 
Reported: 2015-10-13 08:10 EDT by Peter Vreman
Modified: 2016-07-27 05:19 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-27 05:19:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 13923 None None None 2016-04-26 12:56 EDT

  None (edit)
Description Peter Vreman 2015-10-13 08:10:14 EDT
Description of problem:
Using the API to list repositories is slow. Rendering the view of 24 repositories of the redhat server product takes 30 seconds:

time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3,\"product_id\":14}" -XGET https://localhost/katello/api/v2/repositories > p.json

real    0m34.105s
user    0m0.178s
sys     0m0.054s

[crash] root@li-lc-1578:~# hoi-json p.json --get results.id | wc -l
24

2015-10-13 12:00:50 [I] Processing by Katello::Api::V2::RepositoriesController#index as */*
2015-10-13 12:00:50 [I]   Parameters: {"per_page"=>9999, "organization_id"=>3, "product_id"=>14, "api_version"=>"v2", "repository"=>{"product_id"=>14}}
2015-10-13 12:00:51 [I] Authorized user hoici(hoici )
2015-10-13 12:01:23 [I]   Rendered /opt/rh/ruby193/root/usr/share/gems/gems/katello-2.2.0.67/app/views/katello/api/v2/repositories/index.json.rabl within katello/api/v2/layouts/collection (28697.1ms)



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Enable 25 repositories under RedHat Server product
2. List repositories through API
3.

Actual results:
Listing takes 30 seconds

Expected results:
Listing takes <5 seconds


Additional info:
Comment 1 Peter Vreman 2015-10-13 08:10:26 EDT
Sync plans are not used, as mentioned in the a related BZ1253802
Comment 2 Peter Vreman 2015-10-13 08:10:51 EDT
See also BZ1271160 for products listing, that might be related
Comment 4 Justin Sherrill 2016-02-26 18:48:17 EST
Connecting redmine issue http://projects.theforeman.org/issues/10208 from this bug
Comment 5 Bryan Kearney 2016-02-26 20:02:33 EST
Upstream bug component is Content Management
Comment 7 Justin Sherrill 2016-02-26 22:01:12 EST
Connecting redmine issue http://projects.theforeman.org/issues/13923 from this bug
Comment 8 Justin Sherrill 2016-02-26 22:23:01 EST
For some comparison with this change.  On 6.2 (katello 3.0) i was able to list 
~20 Red Hat Repositories (all RHEL 6.X and 7.X repos) in 500-1500ms.  

When I upped that to 36 repos (adding more RHEL 6.x and RHEV agent repos) it went a bit higher to 4000-5000ms.
Comment 10 jcallaha 2016-04-29 08:56:44 EDT
Verified in Satellite 6.2 Beta RC. Listing over 50 repositories of a product took 7 seconds. ~20 repositories took just over 2 seconds.

time curl -k -u admin:<passowrd> -H "Content-Type: application/json" -d '{"per_page":9999,"organization_id":1,"product_id":9}' -XGET https://rhsm-qe-1.rhq.lab.eng.bos.redhat.com/katello/api/v2/repositories

...
real	0m7.124s
user	0m0.031s
sys	0m0.061s
Comment 11 Peter Vreman 2016-06-29 10:49:08 EDT
Confirmed on Sat6.2.0 Beta2

For 19 repos:

[crash] root@li-lc-1578:~# time curl -K /opt/hoici/etc/sat6/curl-hoici.conf "-HContent-Type: application/json" "-d{\"per_page\":9999,\"organization_id\":3,\"product_id\":14}" -XGET https://localhost/katello/api/v2/repositories > p.json

real    0m5.266s
user    0m0.041s
sys     0m0.066s


The output is strange regading the sync_plan part, it contains an Array with for the end-user useless information:


      "name": "Red Hat Enterprise Linux 6 Server RPMs x86_64 6Server",
      "label": "Red_Hat_Enterprise_Linux_6_Server_RPMs_x86_64_6Server",
      "product": {
        "sync_plan": [
          "name",
          "description",
          "sync_date",
          "interval",
          "next_sync"
        ],
        "name": "Red Hat Enterprise Linux Server",
        "cp_id": "69",
        "id": 14
      },
      "last_sync": {
        "progress": 1,
Comment 13 errata-xmlrpc 2016-07-27 05:19:46 EDT
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.