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

Speed up MiqEventDefinitionSet.seed #14721

Merged
merged 1 commit into from
Apr 11, 2017

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Apr 11, 2017

MiqEventDefinitionSet is static union. It is unfortunate to use 13 selects on every start-up (during the db lock) to ensure that the union is in place.

On my system, the 10_000.times { MiqEventDefinitionSet.seed } gives:

💋 rows selects time %
Before 130000 130000 123s 100%
After 130000 10000 34s 27%

Note: MiqEventDefinition.seed is second biggest abuser after BlackListedEvent (#14712)

MiqEventDefinitionSet is static union. It is dumb to use 13 selects
on every start-up (during the db lock) to ensure that the union is
in place.

On my system, the `10_000.times { MiqEventDefinitionSet.seed }` gives:

:kiss: |  rows  | selects | time |  %
-------| ------ | ------- | ---- | ----
Before | 130000 |  130000 | 123s | 100%
After  | 130000 |   10000 |  34s |  27%
@miq-bot
Copy link
Member

miq-bot commented Apr 11, 2017

Checked commit isimluk@ad4c647 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks good. ⭐

@isimluk
Copy link
Member Author

isimluk commented Apr 11, 2017

Hm, I just found this method is called TWICE on start-up. ♻️

@Fryguy Fryguy merged commit 42e8fc0 into ManageIQ:master Apr 11, 2017
@Fryguy Fryguy added this to the Sprint 59 Ending Apr 24, 2017 milestone Apr 11, 2017
@Fryguy Fryguy assigned Fryguy and unassigned kbrock Apr 11, 2017
@Fryguy Fryguy added fine/yes and removed fine/no labels Apr 11, 2017
simaishi pushed a commit that referenced this pull request Apr 11, 2017
…seeds

Speed up MiqEventDefinitionSet.seed
(cherry picked from commit 42e8fc0)
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 54ffffafbfd5dbf20fcbcf1b6ba584cbea8bcceb
Author: Jason Frey <[email protected]>
Date:   Tue Apr 11 11:11:25 2017 -0400

    Merge pull request #14721 from isimluk/speed-up-miq_event_definition-seeds
    
    Speed up MiqEventDefinitionSet.seed
    (cherry picked from commit 42e8fc031aacc9c09bed83b923d0f973276d91b1)

@isimluk isimluk deleted the speed-up-miq_event_definition-seeds branch April 12, 2017 08:26
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.

5 participants