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
Created redmine issue https://projects.theforeman.org/issues/25577 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25577 has been resolved.
Checked on Satellite 6.6 snap 17, confirming that the updated lookup keys landed downstream. No significant delay experienced with the aforementioned query.
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