Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Performance] MiqEventDefinition.seed speedup #15630

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Jul 21, 2017

MiqEventDefinition is the slowest of the primordial seeds

The main culprit is the fact that miq_sets uses relationships.

ms bytes objects query query ms rows comments
2,595.0 51,390,823* 645,934 719 1,653.5 1,036 nop before
2,121.1 45,063,997* 577,455 542 1,297.0 1,036 nop after
18% 12% 11% 25% 22% 0 diff

details

This removes a number of N+1 queries but does not remove the main culprit. That would probably require reimplementing miq_sets.

If you note the SELECT miq_event_definitions are merged together. 338ms+36ms => 51ms

ms bytes objects query query ms rows comments
2,595.0 51,390,823* 645,934 719 1,653.5 1,036 MiqEventDefinition-1
338.8 178 305.9 178 .SELECT "miq_event_definitions".*
36.0 14 29.1 166 .SELECT "miq_event_definitions".*
628.8 167 579.5 180 .SELECT "miq_sets".*
190.2 166 162.7 166 .SELECT "relationships"."ancestry"
459.7 194 434.6 346 .SELECT "relationships".*
ms bytes objects query query ms rows comments
2,121.1 45,063,997* 577,455 542 1,297.0 1,036 MiqEventDefinition-1
51.5 15 31.1 344 .SELECT "miq_event_definitions".*
569.9 167 523.2 180 .SELECT "miq_sets".*
196.6 166 167.8 166 .SELECT "relationships"."ancestry"
479.0 194 455.8 346 .SELECT "relationships".*

related to:

@kbrock kbrock force-pushed the seeding_event_definition branch from 33185ba to 52a09de Compare July 22, 2017 01:16
@kbrock kbrock force-pushed the seeding_event_definition branch 2 times, most recently from d9ea401 to e4a6d39 Compare August 1, 2017 13:22
Copy link
Member

@carbonin carbonin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just fix up the variable shadowing.

The two e's are a bit hard to understand.

@carbonin carbonin assigned carbonin and unassigned gtanzillo Oct 11, 2017
note seed_default_events updates the event_defs cache/hash
so it is available for seed_default_definitions
@kbrock kbrock force-pushed the seeding_event_definition branch from e4a6d39 to 8013df3 Compare October 20, 2017 23:20
@miq-bot
Copy link
Member

miq-bot commented Oct 20, 2017

Checked commit kbrock@8013df3 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks fine. ⭐

@kbrock
Copy link
Member Author

kbrock commented Oct 20, 2017

Thanks @carbonin

Changes:

  • removed the e shadow.
  • The events created are now added to the local cache of events. Duplicates in the file (which shouldn't happen) will behave as before.

@carbonin carbonin added this to the Sprint 72 Ending Oct 30, 2017 milestone Oct 23, 2017
@carbonin carbonin merged commit 9d3a011 into ManageIQ:master Oct 23, 2017
@kbrock kbrock deleted the seeding_event_definition branch October 23, 2017 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants