Bug 1417437

Summary: Listing Applicable hosts for any errata takes long time at scale
Product: Red Hat Satellite Reporter: Pradeep Kumar Surisetty <psuriset>
Component: Errata ManagementAssignee: John Mitsch <jomitsch>
Status: CLOSED DUPLICATE QA Contact:
Severity: urgent Docs Contact:
Priority: high    
Version: 6.2.6CC: bbuckingham, bkearney, cduryee, dcaplan, egolov, jcallaha, jhutar, jomitsch, mmccune, pmoravec, psuriset
Target Milestone: UnspecifiedKeywords: Performance, PrioBumpField, PrioBumpPM, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-23 18:02:55 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:
Attachments:
Description Flags
postgresql mem @errata for 4k
none
postgresql opetations
none
memory growth while listing applicable hosts for errata
none
ruby memory growth while listing 4k hosts for errata
none
memory usage per process none

Description Pradeep Kumar Surisetty 2017-01-29 10:51:11 UTC
Description of problem:

Have 6k hosts registered to setup.
Selected an errata which is applicable for 4K+ hosts. Took more than 6 mins to list

content -> errata -> any errata -> Applicable content Hosts of respective errata

GET https://gprfc018.sbu.lab.eng.bos.redhat.com/api/v...h=(+applicable_errata+%3D+%22RHBA-2015:2115%22+) 200 OK 	6m 35s

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


How reproducible:


Steps to Reproduce:
1.with Scale environment
 content -> errata -> any errata -> Applicable content Hosts of respective errata
2. 
3.

Actual results:

List Applicable content Hosts of respective errata at scale takes long time

Expected results:

Take lesser time to open 
Additional info:

Comment 3 Pradeep Kumar Surisetty 2017-01-29 11:18:31 UTC
Created attachment 1245533 [details]
postgresql mem @errata for 4k

Comment 4 Pradeep Kumar Surisetty 2017-01-29 11:19:42 UTC
Created attachment 1245534 [details]
postgresql opetations

Comment 5 Pradeep Kumar Surisetty 2017-01-29 11:22:00 UTC
Created attachment 1245535 [details]
memory growth while listing applicable hosts for errata

Comment 6 Pradeep Kumar Surisetty 2017-01-29 11:24:04 UTC
Created attachment 1245537 [details]
ruby memory growth while listing 4k hosts for errata

Comment 7 Pradeep Kumar Surisetty 2017-01-29 11:26:01 UTC
Created attachment 1245538 [details]
memory usage per process

while true; do   (date && ps aux --sort -rss | head -n20) >> /var/log/foreman/ps-aux2.log;   sleep 60; done

Comment 8 Jan Hutaƙ 2017-01-29 14:13:23 UTC
I have configured logging of queries longer than 1sec:

  log_min_duration_statement = 1000

and refreshed the page, but it did not shown anything. Then I have displayed number of transactions processed by server (well, one transaction can have 0 - more queries), refreshed the page and checked the transaction count again:

  postgres=# SELECT sum(xact_commit+xact_rollback) FROM pg_stat_database;
    sum   
  --------
   810380
  (1 row)

...refresh and wait:

  postgres=# SELECT sum(xact_commit+xact_rollback) FROM pg_stat_database;
    sum   
  --------
   939428
  (1 row)

I.e. almost 130k transactions to refresh one page. Well, there is something else running on the Satllite, but still.

Comment 10 John Mitsch 2017-02-23 16:43:29 UTC
Created redmine issue http://projects.theforeman.org/issues/18652 from this bug

Comment 11 John Mitsch 2017-02-23 17:42:35 UTC
I'm not seeing this behavior on the reproducer anymore. I'm selecting a specific Errata and going to the Content Hosts tab. Is this the correct workflow?

Comment 12 Pradeep Kumar Surisetty 2017-02-23 18:02:55 UTC

*** This bug has been marked as a duplicate of bug 1417642 ***