Bug 1021980

Summary: Foreman dashboard is very slow for non admin users in a large environment
Product: Red Hat Satellite Reporter: Chuck Schweizer <chuck.schweizer.lvk2>
Component: ProvisioningAssignee: Dmitri Dolguikh <dmitri>
Status: CLOSED ERRATA QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, bkearney, cwelton, dcleal, jmontleo, mmccune, ohadlevy, omaciel
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/5841
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 08:40:39 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:

Description Chuck Schweizer 2013-10-22 12:41:17 UTC
Description of problem:

A non admin user takes a very long time to load the Dashboard page if they have many nodes. In this instance there were 18,700 nodes returned. The following is the query most/all of the time is spent on. Possibly this should be a join or something more efficient than an IN list.

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

Validated it still exists on foreman 1.3

How reproducible:
easily reproducible if you have a large number of nodes.

Steps to Reproduce:
1.  Add a large number of nodes to foreman/satellite
2.  login as a non admin user
3.  go to the foreman dashboard

Actual results:
Page take a very long time to load.

Expected results:
Page should load in a few seconds.

Additional info:

This is the specific query

Report Load (181884.5ms)  SELECT "reports".* FROM "reports" WHERE "reports"."host_id" IN (15632, 1364, 6679, 12390, 7214, 1387, 8102, 10022, 14954, 782, 9807, 16707, 19704, 14674, 9565, 10311, 2396, 638, 8698, 10085, 278, 371, 16729, 586, 642,
<----- cut  ----->
12460, 1717, 10215, 10568, 10469, 9631, 5912, 2390, 2434, 11247, 5749, 5275, 15752, 8620, 59, 7299, 7696, 6026, 8782, 11067, 13031, 8884, 18279, 10776, 19298, 19214, 17388, 294, 2033, 3398) AND (status != 0) AND (("reports"."reported_at" >= '2013-08-22')) ORDER BY "reports"."reported_at" DESC NULLS LAST LIMIT 6

Comment 2 Dominic Cleal 2013-10-22 13:12:31 UTC
Fixed in 83b2874539b2b5469586a23b1edacbdf2a88d2ef in develop.

Comment 6 Dominic Cleal 2014-05-22 18:28:27 UTC
Chuck's reported that Foreman's introduced a regression and it's slowed down again.  It appears that the move to the new authorisation system's caused it as the method concerned has been split into a step to pull back all of the host IDs and then another to look up reports.  It needs dev work again to see if this can be optimised.

Comment 8 Bryan Kearney 2015-08-25 17:35:54 UTC
Upstream bug component is Provisioning

Comment 9 Bryan Kearney 2015-08-25 20:39:19 UTC
Upstream bug component is Provisioning

Comment 14 errata-xmlrpc 2016-07-27 08:40:39 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:1500