Bug #25577
closedConfigure -> Smart class parameters page took long time to load
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1643847
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 => :indexdef 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
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/6290 added
Updated by Shimon Shtein almost 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 6d9e2b7c61bf1e64df01baad7e0a75a220211b57.