Bug 1643847 - Configure -> Smart class parameters page took long time to load
Summary: Configure -> Smart class parameters page took long time to load
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Smart Variables
Version: 6.3.4
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: 6.6.0
Assignee: Shimon Shtein
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-10-29 08:14 UTC by Hao Chang Yu
Modified: 2019-10-22 19:50 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:
Environment:
Last Closed: 2019-10-22 19:50:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25577 0 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)
   end

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.

Comment 11 Peter Ondrejka 2019-08-30 11:51:08 UTC
Checked on Satellite 6.6 snap 17, confirming that the updated lookup keys landed downstream. No significant delay experienced with the aforementioned query.

Comment 12 Bryan Kearney 2019-10-22 19:50:06 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/RHSA-2019:3172


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