Speed up Routing Nodes Priority Comparator#78609
Merged
original-brownbear merged 2 commits intoelastic:masterfrom Oct 4, 2021
original-brownbear:speed-up-priority-sort
Merged
Speed up Routing Nodes Priority Comparator#78609original-brownbear merged 2 commits intoelastic:masterfrom original-brownbear:speed-up-priority-sort
original-brownbear merged 2 commits intoelastic:masterfrom
original-brownbear:speed-up-priority-sort
Conversation
This one shows up very hot if sorting a long list of shards because of the cost of looking up the settings over and over. Lazy+best-effort caching the two settings that get looked up significantly speeds up the routing sorting.
Collaborator
|
Pinging @elastic/es-distributed (Team:Distributed) |
| final String o1Index = o1.getIndexName(); | ||
| final String o2Index = o2.getIndexName(); | ||
| final Index o1Index = o1.index(); | ||
| final Index o2Index = o2.index(); |
Contributor
Author
There was a problem hiding this comment.
Better compare the Index here than just their names. If we have instance equality it's the same performance as comparing names. If we have different indices, the UUID strings will compare quicker than index names because there's no common prefixes.
DaveCTurner
reviewed
Oct 4, 2021
Member
DaveCTurner
left a comment
There was a problem hiding this comment.
Could we just make these final fields that get read from the settings in IndexMetadata$Builder#build()?
Contributor
Author
🤦♂️ yea that's less stupid :) thanks! |
Contributor
Author
|
Thanks David! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This one shows up very hot if sorting a long list of shards because of the
cost of looking up the settings over and over. Lazy+best-effort caching
the two settings that get looked up significantly speeds up the routing sorting.