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
Upstream bug component is Dashboard
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/16893 has been resolved.
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.
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