-
Notifications
You must be signed in to change notification settings - Fork 898
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
[Performance] MiqGroup.seed #15586
Conversation
3bb9c18
to
85c0f15
Compare
app/models/miq_group.rb
Outdated
@@ -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) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
Simple N+1 fix
85c0f15
to
a7e6518
Compare
Checked commits kbrock/manageiq@09d354d~...a7e6518 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
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
group.miq_user_role
was causing a bunch of sub queries, so we added anif
blockServerRole
comments
MiqGroup
beforeMiqGroup
afterdelta
* Memory usage does not reflect 921 freed objects.
comments
ServerRole
beforeServerRole
after* Memory usage does not reflect 134 freed objects.
Spurred by
https://bugzilla.redhat.com/show_bug.cgi?id=1422671