-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Make AllocationService#adaptAutoExpandReplicas Faster #83092
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
Make AllocationService#adaptAutoExpandReplicas Faster #83092
Conversation
This method is getting fairly expensive for large cluster states. In most cases it is not necessary to actually compute the `RoutingAllocation` so I made that lazy to save potentially needlessly building routing nodes. Also, parsing the auto-expand-replicas setting gets quite expensive when looping over thousands of shards in this method so I moved the auto-expand setting value into the index metadata. These changes make the method disappear from profiling in most cases and help make reroute yet a bit faster.
Pinging @elastic/es-distributed (Team:Distributed) |
Hi @original-brownbear, I've created a changelog YAML for you. |
@@ -42,15 +43,10 @@ | |||
|
|||
private final AllocationDeciders deciders; | |||
|
|||
@Nullable | |||
private final RoutingNodes routingNodes; |
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.
We don't need to generate this when constructing the object. In some cases the routing nodes are never needed for the concrete cluster state passed in here because none of the allocators care about it. So we can selectively make it lazy like this and pass in the mutable variant as an override.
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.
LGTM
Thanks David! |
This method is getting fairly expensive for large cluster states.
In most cases it is not necessary to actually compute the
RoutingAllocation
so I made that lazy to save potentially needlessly building routing nodes.
Also, parsing the auto-expand-replicas setting gets quite expensive when looping
over thousands of shards in this method so I moved the auto-expand setting value
into the index metadata.
These changes make the method disappear from profiling in most cases and help
make reroute yet a bit faster.
relates #77466