Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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.