-
Notifications
You must be signed in to change notification settings - Fork 881
feat(shard-distributor): load-based rebalancing and placement #7536
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
Open
AndreasHolt
wants to merge
215
commits into
cadence-workflow:master
Choose a base branch
from
AndreasHolt:load_balance
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,478
−266
Conversation
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
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
… is being reassigned in AssignShard Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
…to not overload etcd's 128 max ops per txn Signed-off-by: Andreas Holt <[email protected]>
…s txn and retry monotonically Signed-off-by: Andreas Holt <[email protected]>
…ents Signed-off-by: Andreas Holt <[email protected]>
…shard metrics, move out to staging to separate function Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
… And more idiomatic naming of collection vs singular type Signed-off-by: Andreas Holt <[email protected]>
…ook more like executor key tests Signed-off-by: Andreas Holt <[email protected]>
…ey in BuildShardKey, as we don't use it Signed-off-by: Andreas Holt <[email protected]>
…o "statistics" Signed-off-by: Andreas Holt <[email protected]>
…ollow conventions Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
…eartbeat TTL Signed-off-by: Andreas Holt <[email protected]>
…o ewma) Signed-off-by: Andreas Holt <[email protected]>
…t heartbeat Signed-off-by: Andreas Holt <[email protected]>
…rdStatistics Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Theis Randeris Mathiassen <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Theis Randeris Mathiassen <[email protected]>
Signed-off-by: Theis Randeris Mathiassen <[email protected]>
bfa46ae to
44f8ac5
Compare
44f8ac5 to
bfa46ae
Compare
This reverts commit 0d3f7e0. Signed-off-by: Andreas Holt <[email protected]>
This reverts commit 81f2021. Signed-off-by: Andreas Holt <[email protected]>
This reverts commit fe06ac8. Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
…orStatisticsEvent Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Theis Mathiassen <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
…tistics Signed-off-by: Andreas Holt <[email protected]>
… load_balance Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
Signed-off-by: Andreas Holt <[email protected]>
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.
What changed?
We added load balancing to the leader’s periodic reconciliation (inside rebalanceShardsImpl). It now moves shards when executors fall outside hysteresis bands around the cluster’s mean load. Moves are limited by a per-pass budget that scales with the total number of shards, and the loop stops when the budget is used up or things are back within the bands. For each candidate move we compute a “benefit”, and we only move a shard if that benefit is positive. We also added/updated metrics around load balance and shard movement. Finally, ephemeral shard placement was changed to assign new shards to the ACTIVE executor with the lowest load (instead of the one with the fewest shards).
Why?
How did you test it?
Ran the shard distributor unit tests locally, including new/updated load-balancing tests in service/sharddistributor/leader/process/loadbalance_test.go and handler tests under service/sharddistributor/handler
We have also tested it with running it with multiple canary instances, and then logging the moves. The logs showed shards being moved from executors with high load to executors with low load.
Potential risks