-
Notifications
You must be signed in to change notification settings - Fork 25
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
Improve server listing performance #602
base: master
Are you sure you want to change the base?
Conversation
var filteredNodes []Node | ||
|
||
err := servers.List(c.ComputeClient, servers.ListOpts{}).EachPage(func(page pagination.Page) (bool, error) { | ||
err := servers.List(c.ComputeClient, servers.ListOpts{Name: "^(kks-)?" + k.Spec.Name + "-" + pool.Name + "-"}).EachPage(func(page pagination.Page) (bool, error) { |
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.
@joker-at-work Is using a regex for listing servers by name safe and won't break in the future in your opinion? Seems like its depended on the database used for nova which unsettles me a bit.
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.
All I can say is that we don't plan to change the DB under Nova once again.
FYI this is the function translating the string into the query: https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L1943-L1973 Looks pretty DB-dependent. It basically just uses a sanitized version of whatever you provide.
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.
Ok thanks.
6c88d3c
to
099d894
Compare
Instead of listing all servers of a project we use a name filter the uses the regex `^(kks?)-$KLUSTERNAME-$POOLNAME` for the `name` attribute. In addition we also process the pages individually when filtering through the returned servers.
263521b
to
a8b07b5
Compare
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Instead of listing all servers of a project we use a name filter with the regex
^(kks-?)$KLUSTERNAME-$POOLNAME
for thename
attribute.In addition we also process the pages individually when filtering through the returned servers.
This should avoid listing thousands of servers from s4 projects on a constant basis.
CAREFUL: This needs extra special testing and careful review. If the listing is somehow filtering out valid kubernikus nodes launchctl will spawn new servers until the quota is exceeded.