Project

General

Profile

Bug #30053

Audit page render very slow when organization is set

Added by Hao Yu about 1 year ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Audit Log
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

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

  1. select count(*) from audits;
    count
    -------
    76620
    (1 row)
  1. select count(*) from taxable_taxonomies where taxable_type = 'Audited::Audit';
    count
    --------
    125586

Related issues

Related to Foreman - Refactor #32029: Add test coverage for Audit permissionsClosed

Associated revisions

Revision 9b62448c (diff)
Added by Hao Yu 3 months ago

Fixes #30053 - Audit page render slow when organization is set

History

#1 Updated by The Foreman Bot about 1 year ago

  • Assignee set to Hao Yu
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7728 added

#2 Updated by Hao Yu about 1 year ago

Patching Results:

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

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

#3 Updated by The Foreman Bot 8 months ago

  • Status changed from Ready For Testing to New
  • Pull request deleted (https://github.com/theforeman/foreman/pull/7728)

#4 Updated by The Foreman Bot 8 months ago

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

#5 Updated by The Foreman Bot 5 months ago

  • Status changed from Ready For Testing to New
  • Pull request deleted (https://github.com/theforeman/foreman/pull/7728)

#6 Updated by The Foreman Bot 4 months ago

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

#7 Updated by Ondřej Ezr 4 months ago

  • Related to Refactor #32029: Add test coverage for Audit permissions added

#8 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 2.5.0 added

#9 Updated by Hao Yu 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF