Bug 1384199 - Host Collection widget takes too long to render
Summary: Host Collection widget takes too long to render
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Dashboard
Version: 6.2.2
Hardware: All
OS: Linux
Target Milestone: Unspecified
Assignee: Chris Duryee
QA Contact: sthirugn@redhat.com
Depends On:
Blocks: 1385759
TreeView+ depends on / blocked
Reported: 2016-10-12 19:26 UTC by Marcelo Moreira de Mello
Modified: 2020-01-17 16:01 UTC (History)
12 users (show)

Fixed In Version: tfm-rubygem-katello-
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1385759 (view as bug list)
Last Closed: 2016-11-10 08:14:26 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Foreman Issue Tracker 16893 None None None 2016-10-12 19:39:18 UTC
Red Hat Knowledge Base (Solution) 2695881 None None None 2016-10-12 19:42:26 UTC
Red Hat Product Errata RHBA-2016:2699 normal SHIPPED_LIVE Satellite 6.2.4 Async Bug Release 2016-11-10 13:12:22 UTC

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):

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.


Note You need to log in before you can comment on or make changes to this bug.