From Chaos to Control: Addressing Shard Distribution Challenges in M3DB with Subclusters
Summary
M3DB’s sharded placement algorithm lets replicas spread across nodes subject primarily to isolation-group constraints, but large clusters experienced broad failure and maintenance impacts. The subclustered placement algorithm partitions nodes into fixed-size, self-contained groups, each owning a distinct shard slice while preserving replica separation across isolation groups. It requires equal instance weights, scaling in multiples of the subcluster size, a replica factor that cannot change through AddReplica, and instancesPerSubcluster divisible by RF. During scaling, a greedy donation strategy simulates removing each candidate shard, ranks the resulting per-node skew, and chooses the shard that leaves the donor most balanced, avoiding a second rebalancing move. The resulting model contains recovery within subclusters, enables parallel maintenance, and reduces arbitrary shard sharing from O(cluster) to O(subcluster), while the original algorithm remains suitable for smaller clusters or impractical scaling steps.
Context
As M3DB clusters grew, freely distributed shard ownership created broad failure domains, extensive I/O and network strain, and maintenance operations that had to be serialized because nodes across isolation groups could share shards.
Approach / What changed
Subclustered placement partitions nodes into fixed-size groups with non-overlapping shard ownership. It preserves isolation-group fault tolerance, uses greedy shard donation to limit intra-subcluster skew during scaling, permits only one partial subcluster during transitions, and retains instance-level placement operations for sequential migrations.
Takeaways
Each subcluster owns a distinct shard slice, so a node failure initiates recovery work only within its own subcluster.
The greedy migration strategy evaluates the skew caused by removing every candidate shard and chooses the removal that leaves the donor subcluster most balanced.
Subclustered placement requires equal instance weights, subcluster-sized scaling steps, instancesPerSubcluster divisible by RF, and no replica-factor changes through AddReplica.
Source and freshness
- Source
- uber.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.