Partitioning & Load

1 / 7

Core goal

Scale out without losing correctness:

  • deterministic key ownership
  • balanced runtime load
2 / 7

Layer 1: ownership

Consistent hash ring:

  • owner = first token clockwise
  • wrap on ring end
  • deterministic tie-breaks for duplicate positions
3 / 7

Layer 2: replica placement

Ring walk from owner:

  • distinct nodes only
  • deterministic order
  • prefer failure-domain diversity (zone/rack)
4 / 7

Layer 3: rebalancing

Move shards only when it helps.

Constraints matter:

  • move budget
  • pinned shards
  • monotonic improvement
  • oscillation avoidance
5 / 7

Key pitfalls

  • repeated replicas on same node/domain
  • unstable tie-breaks
  • moves that worsen max-min gap
  • endless rebalance loops
6 / 7

Exercise progression

  1. Ownership resolver
  2. Domain-aware replica planner
  3. Constrained rebalance capstone
7 / 7
Use arrow keys or click edges to navigate. Press H to toggle help, F for fullscreen.