Bug #30053
closedAudit page render very slow when organization is set
Description
Description of problem:
Audit page render very slow when organization is set even only 20 records per page.
2020-06-08T07:24:11 [I|app|6ec3a037] Started GET "/audits?page=1&per_page=20&search=" for 10.64.54.43 at 2020-06-08 07:24:11 +0000
2020-06-08T07:24:11 [I|app|6ec3a037] Processing by AuditsController#index as JSON
2020-06-08T07:24:11 [I|app|6ec3a037] Parameters: {"page"=>"1", "per_page"=>"20", "search"=>""}
2020-06-08T07:24:43 [I|app|6ec3a037] Completed 200 OK in 32188ms (Views: 30.9ms | ActiveRecord: 30341.6ms) <======== Took 32 seconds to load
- select count(*) from audits;
count
-------
76620
(1 row)
- select count(*) from taxable_taxonomies where taxable_type = 'Audited::Audit';
count
--------
125586
Updated by The Foreman Bot over 4 years ago
- Status changed from New to Ready For Testing
- Assignee set to Hao Yu
- Pull request https://github.com/theforeman/foreman/pull/7728 added
Updated by Hao Yu over 4 years ago
Patching Results:
- Before Patching #
Organization.current = Organization.find(1)
Benchmark.measure { Audit.taxed_and_untaxed.size }
=> #<Benchmark::Tms:0x000000000e467400 @label="", @real=15.642092013731599, @cstime=0.0, @cutime=0.0, @stime=0.004931000000000019, @utime=0.3778380000000041, @total=0.38276900000000413>
Benchmark.measure { Audit.taxed_and_untaxed.search_for("").paginate(:page => 1, :per_page => 20).to_a }
=> #<Benchmark::Tms:0x00000000128c1ec0 @label="", @real=30.39286920009181, @cstime=0.0, @cutime=0.0, @stime=0.008691999999999922, @utime=0.42596799999999746, @total=0.4346599999999974>
Audit.taxed_and_untaxed.size
=> 76438
- After patching #
Organization.current = Organization.find(1)
Benchmark.measure { Audit.taxed_and_untaxed.size }
=> #<Benchmark::Tms:0x0000000010a3b230 @label="", @real=1.3209850522689521, @cstime=0.0, @cutime=0.0, @stime=0.03110000000000035, @utime=0.4616579999999999, @total=0.49275800000000025>
Benchmark.measure { Audit.taxed_and_untaxed.search_for("").paginate(:page => 1, :per_page => 20).to_a }
=> #<Benchmark::Tms:0x00000000104825f0 @label="", @real=1.429460494313389, @cstime=0.0, @cutime=0.0, @stime=0.0002940000000002385, @utime=0.08602599999999683, @total=0.08631999999999707>
Benchmark.measure { Audit.taxed_and_untaxed.search_for("").paginate(:page => 1, :per_page => 1000).to_a }
=> #<Benchmark::Tms:0x000000000e6f70a8 @label="", @real=1.2610410377383232, @cstime=0.0, @cutime=0.0, @stime=0.001735000000000042, @utime=0.09530999999999779, @total=0.09704499999999783>
Benchmark.measure { Audit.taxed_and_untaxed.search_for("").paginate(:page => 1, :per_page => 10000).to_a }
=> #<Benchmark::Tms:0x0000000010cfb538 @label="", @real=1.890949493739754, @cstime=0.0, @cutime=0.0, @stime=0.020961999999999925, @utime=0.6817709999999977, @total=0.7027329999999976>
Audit.taxed_and_untaxed.size
=> 76438
Updated by The Foreman Bot about 4 years ago
- Status changed from Ready For Testing to New
- Pull request deleted (
https://github.com/theforeman/foreman/pull/7728)
Updated by The Foreman Bot about 4 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7728 added
Updated by The Foreman Bot almost 4 years ago
- Status changed from Ready For Testing to New
- Pull request deleted (
https://github.com/theforeman/foreman/pull/7728)
Updated by The Foreman Bot over 3 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/7728 added
Updated by Ondřej Ezr over 3 years ago
- Related to Refactor #32029: Add test coverage for Audit permissions added
Updated by Hao Yu over 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman|9b62448cd7a95da32323c442555ef37c4707adb4.