Project

General

Profile

Bug #18893

dashboard widget for puppet report latest events can be very slow on large amount of reports

Added by Ohad Levy over 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Performance
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

I have about 3M reports, and I see

16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [I] Started GET "/widgets/19" for ::1 at 2017-03-14 16:02:11 +0200
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [I] Processing by DashboardController#show as HTML
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [I]   Parameters: {"id"=>"19"}
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]   ActiveRecord::SessionStore::Session Load (0.2ms)  SELECT  "sessions".* FROM "sessions" WHERE "sessions"."session_id" = $1  ORDER BY "sessions"."id" ASC LIMIT 1  [["session_id", "843d16a1d11fc12baad1b8281e4926d2"]]
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]   User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1  [["id", 1]]
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [D] Setting current user thread-local variable to admin
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]    (0.3ms)  SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization')
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [D] Setting current organization thread-local variable to none
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]    (0.3ms)  SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location')
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [app] [D] Setting current location thread-local variable to none
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]   AuthSource Load (0.2ms)  SELECT  "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = $1 LIMIT 1  [["id", 1]]
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]    (0.7ms)  SELECT  "taxonomies"."id" FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') LIMIT 1
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]    (0.3ms)  SELECT  "taxonomies"."id" FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') LIMIT 1
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]    (0.4ms)  SELECT COUNT(*) FROM "widgets" 
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]   Widget Load (0.4ms)  SELECT  "widgets".* FROM "widgets" WHERE "widgets"."id" = $1 LIMIT 1  [["id", 19]]
16:02:11 rails.1   | 2017-03-14T16:02:11 843d16a1 [sql] [D]   User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY firstname LIMIT 1  [["id", 1]]
16:04:21 rails.1   | 2017-03-14T16:04:21 843d16a1 [sql] [D]   ConfigReport Exists (129783.2ms)  SELECT  1 AS one FROM "reports" WHERE "reports"."type" IN ('ConfigReport') AND (status <> 0) AND ("reports"."host_id" IN (SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed'))) AND (("reports"."reported_at" >= '2017-03-08')) LIMIT 1
16:04:21 rails.1   | 2017-03-14T16:04:21 843d16a1 [app] [I]   Rendered dashboard/_reports_widget.html.erb (129789.7ms)
16:04:21 rails.1   | 2017-03-14T16:04:21 843d16a1 [app] [I] Completed 200 OK in 129811ms (Views: 10.1ms | ActiveRecord: 129786.7ms)
16:04:21 rails.1   | 2017-03-14T16:04:21 843d16a1 [sql] [D]    (4.2ms)  BEGIN
16:04:21 rails.1   | 2017-03-14T16:04:21 843d16a1 [sql] [D]    (0.2ms)  COMMIT

I believe this happens because we join the reports and hosts table where I'm uncertain its required.


Related issues

Related to Foreman - Bug #16238: dashboard widget for latests events can be exteramlly slowClosed2016-08-23

Associated revisions

Revision 9313f6ad (diff)
Added by Tomer Brisker over 4 years ago

Fixes #18893 - Improve latest events widget performance

History

#1 Updated by Ohad Levy over 4 years ago

  • Related to Bug #16238: dashboard widget for latests events can be exteramlly slow added

#2 Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/4374 added

#3 Updated by Anonymous over 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Ohad Levy over 4 years ago

  • Legacy Backlogs Release (now unused) set to 209

Also available in: Atom PDF