Bug 1643847 - Configure -> Smart class parameters page took long time to load
Summary: Configure -> Smart class parameters page took long time to load
Status: ON_QA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Smart Variables
Version: 6.3.4
Hardware: Unspecified
OS: Linux
medium vote
Target Milestone: 6.6.0
Assignee: Shimon Shtein
QA Contact: Peter Ondrejka
Depends On:
TreeView+ depends on / blocked
Reported: 2018-10-29 08:14 UTC by Hao Chang Yu
Modified: 2019-07-27 03:18 UTC (History)
9 users (show)

Fixed In Version: foreman-1.21.0-0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Foreman Issue Tracker 25577 None None None 2018-11-28 18:43:01 UTC

Description Hao Chang Yu 2018-10-29 08:14:21 UTC
Description of problem:
Configure -> Smart class parameters page may take long time to load when they are hundreds of puppet environments and puppet classes.

The issue appears to be the "eager_load" joins which may be very expensive when there are too many rows. When I try to use "includes" instead of eager_load, the page load many times faster. Previously it spent 170+ seconds to load the page, now only ~5seconds or less.

# diff -u /tmp/puppetclass_lookup_keys_controller.rb.orig /usr/share/foreman/app/controllers/puppetclass_lookup_keys_controller.rb 
--- /tmp/puppetclass_lookup_keys_controller.rb.orig	2018-10-29 18:06:04.103966839 +1000
+++ /usr/share/foreman/app/controllers/puppetclass_lookup_keys_controller.rb	2018-10-29 18:08:03.990375270 +1000
@@ -4,7 +4,7 @@
   before_action :setup_search_options, :only => :index
   def index
-    @lookup_keys = resource_base_search_and_page(:param_classes).smart_class_parameters
+    @lookup_keys = resource_base_search_and_page.includes(:param_classes).distinct.smart_class_parameters
     @puppetclass_authorizer = Authorizer.new(User.current, :collection => @lookup_keys.map{|key| key.param_class.try(:id)}.compact.uniq)

Comment 8 Shimon Shtein 2018-11-28 18:42:59 UTC
Created redmine issue https://projects.theforeman.org/issues/25577 from this bug

Comment 9 Bryan Kearney 2019-01-07 21:12:36 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25577 has been resolved.

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