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 improvements for BalancedShardsAllocator #15678
Merged
Merged
Conversation
This file contains 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
final float weightIndex = (node.numShards(index) - balancer.avgShardsPerNode(index)); | ||
assert theta != null; | ||
return theta[0] * weightShard + theta[1] * weightIndex; | ||
public float weight(Balancer balancer, ModelNode node, String index, int numAdditionalShards) { |
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.
can we instead of exposing this additional parameter just have some dedicated methods for +1
, -1
, 0
and keep that method internal?
left one comment - LGTM otherwise |
…emoved shard Removal of the pattern node.addShard() -> calculate weight -> node.removeShard() which is expensive as, beside map lookups, it invalidates caching of precomputed values in ModelNode and ModelIndex. Replaced by adding an additional parameter to the weight function which accounts for the added / removed shard.
…hard of that index or where the index can be allocated This allows to prune a large number of nodes in case of hot/warm setup
ywelsch
force-pushed
the
enhance/faster-balancer
branch
from
December 28, 2015 18:15
8dd0674
to
7e134da
Compare
Addressed comment and added labels. Thanks for the review! |
ywelsch
pushed a commit
that referenced
this pull request
Dec 28, 2015
Speed improvements for BalancedShardsAllocator
Nice! |
lcawl
added
:Distributed/Distributed
A catch all label for anything in the Distributed Area. If you aren't sure, use this one.
and removed
:Allocation
labels
Feb 13, 2018
clintongormley
added
:Distributed/Allocation
All issues relating to the decision making around placing a shard (both master logic & on the nodes)
and removed
:Distributed/Distributed
A catch all label for anything in the Distributed Area. If you aren't sure, use this one.
labels
Feb 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Distributed/Allocation
All issues relating to the decision making around placing a shard (both master logic & on the nodes)
>enhancement
v2.3.0
v5.0.0-alpha1
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 PR contains some speed improvements for
BalancedShardsAllocator
(relates to #6372):node.addShard() -> calculate weight -> node.removeShard()
which is expensive as, beside map lookups, it invalidates caching of precomputed values inModelNode
andModelIndex
. Replaced by adding an additional parameter to the weight function which accounts for the added / removed shard.IndexMetaData
.I made smaller commits for each improvement to simplify the review process.