Project

General

Profile

Bug #25577

Configure -> Smart class parameters page took long time to load

Added by Shimon Shtein over 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

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.

  1. 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

Associated revisions

Revision 6d9e2b7c (diff)
Added by Shimon Shtein about 4 years ago

Fixes #25577 - updated puppetclass_lookup_keys_controller queries (#6290)

1. Added :inverse_of to relevant objects
2. Changed queries to use less resources.

History

#1 Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6290 added

#2 Updated by Tomer Brisker about 4 years ago

  • Fixed in Releases 1.21.0 added

#3 Updated by Shimon Shtein about 4 years ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF