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 1271221

Summary: API Listing repositories slow, 24 repositories of redhat server product takes 30 seconds
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: Content ManagementAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.2CC: bbuckingham, ehelms, jcallaha, sthirugn, tpapaioa
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/13923
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:19:46 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: 1122832    

Description Peter Vreman 2015-10-13 12:10:14 UTC
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 12:10:26 UTC
Sync plans are not used, as mentioned in the a related BZ1253802

Comment 2 Peter Vreman 2015-10-13 12:10:51 UTC
See also BZ1271160 for products listing, that might be related

Comment 4 Justin Sherrill 2016-02-26 23:48:17 UTC
Connecting redmine issue http://projects.theforeman.org/issues/10208 from this bug

Comment 5 Bryan Kearney 2016-02-27 01:02:33 UTC
Upstream bug component is Content Management

Comment 7 Justin Sherrill 2016-02-27 03:01:12 UTC
Connecting redmine issue http://projects.theforeman.org/issues/13923 from this bug

Comment 8 Justin Sherrill 2016-02-27 03:23:01 UTC
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 12:56:44 UTC
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 14:49:08 UTC
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 09:19:46 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