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

BlacklistedEvent.seed was so slow #14712

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Apr 10, 2017

WHY??

This seed method takes the longest. This method takes 31% time of EvmDatabase.seed_last. On my set-up this method took 3 seconds.

Speed of seeds inside EvmDatabase.seed_last:

 {:class_RssFeed=>0.10288691520690918,
  :class_MiqWidget=>1.6629936695098877,
  :class_MiqAction=>0.04727506637573242,
  :class_MiqEventDefinition=>2.2581591606140137,
  :class_MiqPolicySet=>0.22873830795288086,
  :class_ChargebackRateDetailMeasure=>0.013733148574829102,
  :class_ChargeableField=>0.04409432411193848,
  :class_ChargebackRateDetailCurrency=>0.016520023345947266,
  :class_ChargebackRate=>0.30977392196655273,
  :class_ArbitrationSetting=>0.012874841690063477,
  :class_BlacklistedEvent=>3.0335240364074707,
  :class_Classification=>0.07406258583068848,
  :class_CustomizationTemplate=>0.03467273712158203,
  :class_Dialog=>0.47321200370788574,
  :class_MiqAlert=>0.03574037551879883,
  :class_MiqDialog=>0.24742746353149414,
  :class_MiqEventDefinitionSet=>0.013843536376953125,
  :class_MiqPolicy=>0.0014827251434326172,
  :class_MiqSearch=>0.5813729763031006,
  :class_MiqShortcut=>0.060210227966308594,
  :class_MiqWidgetSet=>0.02152729034423828,
  :class_NotificationType=>0.05846905708312988,
  :class_OrchestrationTemplate=>0.028501272201538086,
  :class_PxeImageType=>0.008610248565673828,
  :class_ScanItem=>0.09435367584228516,
  :class_TimeProfile=>0.020040273666381836,
  :class_MiqAeDatastore=>0.21139287948608398,
  :total_time=>9.695848226547241}]

WHAT??

Use single select instead of 42 different select statements.

Improvement

When I run

10_000.times { BlacklistedEvent.seed }

it gives

🤕 # of queries # of rows time %
Before 420,000 370,000 361.53 s 100.00%
After 10,000 370,000 13.67 s 3.78%

This seed method takes the longest. This method takes 31% time of
EvmDatabase.seed_last. On my set-up this method takes 3 seconds.
@isimluk isimluk force-pushed the blacklisted-event-seed-was-slow branch from 85e0254 to 4f5ec8c Compare April 10, 2017 16:21
@miq-bot
Copy link
Member

miq-bot commented Apr 10, 2017

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

@kbrock kbrock merged commit 1d27ab5 into ManageIQ:master Apr 10, 2017
@kbrock kbrock added this to the Sprint 58 Ending Apr 10, 2017 milestone Apr 10, 2017
@isimluk
Copy link
Member Author

isimluk commented Apr 11, 2017

@miq-bot remove_labe fine/no
@miq-bot add_label fine/yes

@isimluk isimluk deleted the blacklisted-event-seed-was-slow branch April 11, 2017 17:48
@miq-bot
Copy link
Member

miq-bot commented Apr 11, 2017

@isimluk unrecognized command 'remove_labe', ignoring...

Accepted commands are: add_label, assign, close_issue, move_issue, remove_label, rm_label, set_milestone

@isimluk isimluk removed the fine/no label Apr 11, 2017
simaishi pushed a commit that referenced this pull request Apr 13, 2017
BlacklistedEvent.seed was so slow
(cherry picked from commit 1d27ab5)
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit 8d920a1688f8d9330784c6c3385232aace647494
Author: Keenan Brock <[email protected]>
Date:   Mon Apr 10 13:39:43 2017 -0400

    Merge pull request #14712 from isimluk/blacklisted-event-seed-was-slow
    
    BlacklistedEvent.seed was so slow
    (cherry picked from commit 1d27ab526baaf24d2bc34f75e8f5cc786103ffe1)

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