-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Small cleanups to Allocation Performance #89378
Small cleanups to Allocation Performance #89378
Conversation
Two fixes: 1. Looking up `Custom` values over and over for every shard incurs a measurable cost. This removes that cost for desired nodes and node shutdown metadata. 2. Node shutdown metadata logic wasn't inlining nicely because of the wrapped map. No need to be as complicated as we were in many spots, use a simple immutable map for all operations and remove a bunch of branching.
Pinging @elastic/es-distributed (Team:Distributed) |
return Optional.ofNullable((NodesShutdownMetadata) this.custom(NodesShutdownMetadata.TYPE)) | ||
.map(NodesShutdownMetadata::getAllNodeMetadataMap) | ||
.orElse(Collections.emptyMap()); | ||
return this.custom(NodesShutdownMetadata.TYPE, NodesShutdownMetadata.EMPTY).getAllNodeMetadataMap(); |
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.
This is way simpler 👍
private final Map<String, SingleNodeShutdownMetadata> nodeShutdowns; | ||
|
||
@Nullable | ||
private final DesiredNodes desiredNodes; |
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.
Do we need above to make it inline?
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.
This isn't really about inlining. This is just faster outright because we don't have to lookup from the customs map for every shard.
Thanks Ievgen! |
Two fixes:
Custom
values over and over for every shard incurs a measurable cost.This removes that cost for desired nodes and node shutdown metadata.
No need to be as complicated as we were in many spots, use a simple immutable map
for all operations and remove a bunch of branching.
relates #77466