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

Poor Host Factory Performance with Many Hosts #1605

Closed
micahlee opened this issue Jun 9, 2020 · 0 comments
Closed

Poor Host Factory Performance with Many Hosts #1605

micahlee opened this issue Jun 9, 2020 · 0 comments

Comments

@micahlee
Copy link
Contributor

micahlee commented Jun 9, 2020

When a host factory is used to create many hosts (> 1000), the performance of host creation begins to degrade significantly.

This stems from the layers retrieval for the host factory:

This method retrieves all of layer objects the host factory is a member of, in order to add created host objects to these same layers. However, this filter is implemented as Ruby code, rather than through SQL:

conjur/app/models/role.rb

Lines 129 to 133 in e336a1d

def layers
memberships_as_member.select do |membership|
membership.role.kind == "layer"
end.map(&:role)
end

This leads to performance issues because the host factory is a "member of" each host it creates, by nature of being the owner. This means that each host is loaded from the database in order to apply the filter against it (membership.role.kind == "layer").

This layer filter should instead be implemented as SQL query returning only the layer memberships directly from the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants