Skip to content

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

Merged

Conversation

original-brownbear
Copy link
Contributor

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.

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.
@original-brownbear original-brownbear added >non-issue :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v8.0.0 v7.16.0 labels Oct 4, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Oct 4, 2021
@elasticmachine
Copy link
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();
Copy link
Contributor Author

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.

Copy link
Contributor

@DaveCTurner DaveCTurner left a 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()?

@original-brownbear
Copy link
Contributor Author

Could we just make these final fields that get read from the settings in IndexMetadata$Builder#build()?

🤦‍♂️ yea that's less stupid :) thanks!

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@original-brownbear
Copy link
Contributor Author

Thanks David!

@original-brownbear original-brownbear merged commit 6089669 into elastic:master Oct 4, 2021
@original-brownbear original-brownbear deleted the speed-up-priority-sort branch October 4, 2021 13:23
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Oct 4, 2021
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.
original-brownbear added a commit that referenced this pull request Oct 4, 2021
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.
@original-brownbear original-brownbear restored the speed-up-priority-sort branch April 18, 2023 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >non-issue Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants