Bug 1384199

Summary: Host Collection widget takes too long to render
Product: Red Hat Satellite Reporter: Marcelo Moreira de Mello <mmello>
Component: DashboardAssignee: Chris Duryee <cduryee>
Status: CLOSED ERRATA QA Contact: sthirugn <sthirugn>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2.2CC: bbuckingham, bkearney, cduryee, cwelton, dmoessne, jcallaha, mmello, oshtaier, pierre-yves.goubet, sjagtap, sthirugn, zhunting
Target Milestone: UnspecifiedKeywords: PrioBumpGSS, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.0.0.82-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1385759 (view as bug list) Environment:
Last Closed: 2016-11-10 08:14:26 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:
Bug Depends On:    
Bug Blocks: 1385759    

Description Marcelo Moreira de Mello 2016-10-12 19:26:55 UTC
Description of problem:

On large databases, host collection widget takes too long to render. 

We created a test ruby script to simulate and trace the same steps performed by the host collection widget and look at the results:


[root@inhas62145 ~]# cat /tmp/host_collection_widget.rb 
start_time = Time.now
puts "Start time #{start_time}"

User.current = User.anonymous_api_admin

query_start = Time.now
organizations = Organization.current.present? ? [Organization.current] : User.current.allowed_organizations
query_end = Time.now

puts "Organizations query #{query_end - query_start}"
puts "-------------"

query_start = Time.now
critical, warning, ok = Katello::HostCollection.lists_by_updates_needed(organizations)
query_end = Time.now
puts "host_collection list  query #{query_end - query_start}"
puts "-------------"

query_start = Time.now
host_collections = (critical + warning + ok)[0..6]
query_end = Time.now
puts "host_coolections top 0...6 query #{query_end - query_start}"
puts "-------------"

end_time = Time.now
elapsed_time = end_time - start_time
puts "End time #{end_time}"
puts "Elapsed time #{elapsed_time}"
puts "-------------"


irb(main):001:0> load '/tmp/host_collection_widget.rb'
Start time 2016-10-12 14:49:41 -0400
Organizations query 0.003659478
-------------
host_collection list  query 50.057783585
-------------
host_coolections top 0...6 query 4.094e-06
-------------
End time 2016-10-12 14:50:31 -0400
Elapsed time 50.093940405
-------------
=> true
irb(main):002:0> exit


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

How reproducible:
100% with large databases

Steps to Reproduce:
1. Launch dashboard with host_collection widget


Actual results:

 Slow to render widget

Expected results:

 Should return on a reasonable time

Comment 3 Bryan Kearney 2016-10-12 20:09:10 UTC
Upstream bug component is Dashboard

Comment 4 Bryan Kearney 2016-10-13 18:09:31 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16893 has been resolved.

Comment 9 sthirugn@redhat.com 2016-11-09 12:59:32 UTC
Verified in Satellite 6.2.4.  The response times look great.

Note that the Dashboard loading time is still 22 seconds+ but it may be potentially due to other widgets? I am happy to share my setup with a dev if needed to poke around and find other slow loading widgets.  But the host collection widget (had great response time using the script given in the original bug description.  The host collections page loaded fast as well.

Note: This setup had 51 host collections (see screenshot) with each of them containing multiple hosts.  The host collections with large number of hosts are:


# foreman-rake console
/usr/share/foreman/lib/tasks/console.rake:4: warning: already initialized constant ARGV
Loading production environment (Rails 4.1.5)
irb(main):001:0> load '/tmp/host_collection_widget.rb'
Start time 2016-11-09 07:47:10 -0500
Organizations query 0.001516253
-------------
host_collection list  query 0.692292217
-------------
host_coolections top 0...6 query 5.582e-06
-------------
End time 2016-11-09 07:47:11 -0500
Elapsed time 0.706627082
-------------
=> true

Also attached the screenshot of Dashboard.

Comment 13 errata-xmlrpc 2016-11-10 08:14:26 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:2699