-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Speed up Routing Nodes Priority Comparator #78609
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
Speed up Routing Nodes Priority Comparator #78609
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.
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(); |
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.
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.
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.
Could we just make these final
fields that get read from the settings in IndexMetadata$Builder#build()
?
🤦♂️ yea that's less stupid :) thanks! |
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 one shows up very hot if sorting a long list of shards because of the cost of looking up the settings over and over.
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.