Project

General

Profile

Bug #14924

taxonomies/edit.html.erb takes minutes to render

Added by Taylan Develioglu over 2 years ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Organizations and Locations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Trying to open the edit page of either a location or organization takes multiple minutes.

The time is spent rendering taxonomies/edit.html.erb and the passenger process stays ~100% utilization throughout the request.

Log attached is from rails environment set to `development`, notice that it takes over 6 minutes to complete the request.

taxonomies_edit_render.log taxonomies_edit_render.log 30.8 KB Taylan Develioglu, 05/04/2016 05:40 AM
taxonomies_edit_render_w_sql.log.gz taxonomies_edit_render_w_sql.log.gz 2.58 MB Taylan Develioglu, 05/04/2016 06:11 AM
pull_3491_result.log.gz pull_3491_result.log.gz 119 KB Taylan Develioglu, 05/04/2016 08:19 AM

Related issues

Related to Foreman - Bug #10893: Editing organizations/locations hangs in 1.8.2Resolved2015-06-22
Has duplicate Foreman - Bug #10138: Manage Location and Organization unusable once thousands of nodes are assignedDuplicate2015-04-14

Associated revisions

Revision 956055dc (diff)
Added by Tomer Brisker over 2 years ago

Fixes #14924 - Improve performance of taxonomy edit page

Non standard ids were not cached in TaxHost.
This led to multiple repeat queries in the database each time any of the
`*_ids` function were being called.
Used templated were calculated by going over all hosts in the taxonomy
and trying to lookup the provisioning template for each one, we now look
for all templates that match any combination of os, hostgroup and
environment for the taxonomy's hosts.
Hosts in Taxhost did not include the :interface table, leading to n+1
queries for delegated attributes such as subnets and proxies.

History

#1 Updated by Dominic Cleal over 2 years ago

  • Related to Bug #10893: Editing organizations/locations hangs in 1.8.2 added

#2 Updated by Dominic Cleal over 2 years ago

Could be the same as #10893 and related issues, but enabling SQL logging may show for sure (http://theforeman.org/manuals/1.11/index.html#7.2Debugging).

#3 Updated by Taylan Develioglu over 2 years ago

Attached logfile with SQL logging enabled.

It shows a huge amount of this repeating:
2016-05-04 12:01:04 [sql] [D] CACHE (0.0ms) SELECT "templates".* FROM "templates" INNER JOIN "operatingsystems_provisioning_templates" ON "operatingsystems_provisioning_templates"."provisioning_template_id" = "templates"."id" INNER JOIN "operatingsystems" ON "operatingsystems"."id" = "operatingsystems_provisioning_templates"."operatingsystem_id" INNER JOIN "template_kinds" ON "template_kinds"."id" = "templates"."template_kind_id" INNER JOIN "template_combinations" ON "template_combinations"."provisioning_template_id" = "templates"."id" WHERE "templates"."type" IN ('ProvisioningTemplate') AND "operatingsystems"."id" = 1 AND "template_kinds"."name" = 'provision' AND "template_combinations"."hostgroup_id" IS NULL AND "template_combinations"."environment_id" = 1 ORDER BY templates.name LIMIT 1

#4 Updated by Tomer Brisker over 2 years ago

  • Status changed from New to Assigned
  • Assignee set to Tomer Brisker

#5 Updated by The Foreman Bot over 2 years ago

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

#6 Updated by Taylan Develioglu over 2 years ago

I see a significant improvement with PR 3491 active. Wallclock went down from ~6 minutes to ~1 minute. Kudos!.
I do still notice a lot of repeat sql queries being done, however (see attached log).

#7 Updated by Taylan Develioglu over 2 years ago

The final PR reduced wallclock time to ~20s! \o/

#8 Updated by Anonymous over 2 years ago

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

#9 Updated by Marek Hulán over 2 years ago

  • Legacy Backlogs Release (now unused) set to 136

#10 Updated by Ohad Levy over 1 year ago

  • Bugzilla link set to 1396642

#11 Updated by Tomer Brisker over 1 year ago

  • Has duplicate Bug #10138: Manage Location and Organization unusable once thousands of nodes are assigned added

#12 Updated by Daniel Lobato Garcia over 1 year ago

  • Target version set to 1.4.3

Also available in: Atom PDF