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] MiqGroup.seed #15586

Merged
merged 2 commits into from
Aug 1, 2017
Merged

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Jul 17, 2017

Seeding occurs for every boot of every evmserver. It is also in a mutex.
So reducing timing and queries is important for us
Focusing on top 10 worst offenders

  • assigning group.miq_user_role was causing a bunch of sub queries, so we added an if block
  • remove N+1 from ServerRole
ms bytes objects query query ms rows comments
230.0 11,079,289* 144,502 88 64.0 53 MiqGroup before
179.2 7,823,389* 107,821 6 37.1 53 MiqGroup after
22% 29% 25% 93% 42% 0% delta

* Memory usage does not reflect 921 freed objects.

ms bytes objects query query ms rows comments
112.1 1,717,076* 22,025 20 14.5 20 ServerRole before
96.9 1,050,869* 14,724 1 7.3 20 ServerRole after
13.6% 39% 33% 95% 49.7% 0% delta

* Memory usage does not reflect 134 freed objects.

Spurred by
https://bugzilla.redhat.com/show_bug.cgi?id=1422671

@@ -60,15 +60,18 @@ def self.seed
ldap_to_filters = filter_map_file.exist? ? YAML.load_file(filter_map_file) : {}
root_tenant = Tenant.root_tenant

groups = where(:group_type => SYSTEM_GROUP).includes(:entitlement).index_by(&:description)
roles = MiqUserRole.where("name like '%EvmRole-%'").index_by(&:name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't be here only ....where("name like 'EvmRole-%'") ? regard to access to hash by index beginning on 'EvmRole...' on line 68 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

thnx

assigning miq_user_role was causing a bunch of sub queries
@miq-bot
Copy link
Member

miq-bot commented Jul 18, 2017

Checked commits kbrock/manageiq@09d354d~...a7e6518 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. ⭐

@kbrock kbrock changed the title [Performance] MiqGroup#seed [Performance] MiqGroup.seed Jul 21, 2017
@bdunne bdunne merged commit eb5e8c9 into ManageIQ:master Aug 1, 2017
@bdunne bdunne added this to the Sprint 66 Ending Aug 7, 2017 milestone Aug 1, 2017
@bdunne bdunne assigned bdunne and unassigned gtanzillo Aug 1, 2017
@kbrock kbrock deleted the seeding_timeout_group branch August 3, 2017 13:12
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