Limit reassignment when membership changes
With hash(key) modulo N, changing three owners to four changes many remainders. A consistent-hash ring places keys and owner points in one space so an added owner takes a limited portion rather than remapping unrelated ownership. Read partitioning and rebalancing first. Consistent here describes placement behavior, not a guarantee that reads always return current values. Placement and replicated-state agreement remain separate questions.
Use a teaching circle from zero inclusive to 300 exclusive, with A at zero, B at one hundred and C at two hundred. Choose the first owner clockwise at or after the key position, wrapping to zero. Key 120 belongs to C and 240 to A. Specify exact-point equality, wraparound and collisions, as well as the encoded input bytes. Boundary conventions matter because two clients using nearly the same rule can still disagree on authoritative destinations.
Compare a single insertion by hand
Insert D at 150. Keys beyond B's one hundred through D's 150 move to D. Key 120 changes from C to D, while 170 stays at C and 240 at A. This locality assumes existing points remain unchanged. Regenerating every point, node name or seed on each addition loses the property. Save configuration version and stable node identity.
Removing D sends its assigned interval back to successor C. That placement reversal does not safely recover values D wrote. If D is unavailable, actual data needs surviving replicas or backups. Recomputable ownership is not retained data. Connect the ring to copy, catch-up and authority transfer, including stale-map requests. The worked example demonstrates reassignment scope, not a live migration or recovery protocol.
| Key position | Before | After D at 150 |
|---|---|---|
| 90 | B | B |
| 120 | C | D |
| 170 | C | C |
| 240 | A | A |
Use virtual points without promising perfect balance
One point per node can leave uneven intervals. Multiple virtual points spread one physical node across several regions. Assigning more points to a larger node can model capacity weights, but finite key count and workload do not necessarily follow the point ratio exactly. Measure distribution alongside lookup, metadata and movement costs.
A single hot key still selects one primary owner. Equal key count does not imply equal bytes or request rate. Changing virtual-point count is another placement change, and implementations differ in whether existing points remain stable. Do not treat sixty-four points as a universal optimum. Record node counts, largest and smallest assignments, bytes and actual traffic separately. Virtualization of ring points is a distribution technique, not a guarantee of balanced application work.
Select replicas by physical identity and failure domain
The next three ring points can all belong to virtual points of one physical node. Replica selection must skip duplicate physical identities and, where required, separate racks or zones. All clients need a deterministic rule over the same configuration. Even identical replica placement does not decide which value commits; quorum and leader protocols remain additional rules.
Skipping an unavailable node needs a policy for temporary assignment and return to canonical ownership. Clients independently rebuilding rings from their own reachable sets can disagree on the same key. Separate alternative availability routing from authoritative placement. Configuration propagation, generations and stale-owner handling define the write semantics during failure. Hash computation alone does not agree on membership or fence old authority.
Preserve deterministic implementation details
Fix hash algorithm, encoding, delimiters, integer interpretation, collision rules, stable IDs and virtual-point names. A process-randomized built-in hash is unsuitable for persistent placement without an explicit compatibility contract. The lab uses SHA-256 and fixed strings to compare ten thousand keys before and after adding D. Cryptographic strength is not mandatory for every placement use; reproducibility is the reason for this choice.
Assertions require moved keys to go to D and non-D assignments to stay unchanged. Distribution for one versus sixty-four virtual points is observed without asserting one dominates every metric. No live data is copied. Production verification additionally needs updates, deletions, retries and authority cutover. Passing a placement test must not be reported as completing the live migration the test did not perform.
Compare modulo placement with the same experimental inputs
A comparison with modulo placement should retain keys, hash and membership before and after addition. Renumbering existing nodes introduces another change. Save reassignment count, per-owner distribution and lookup cost together. A ring can move relatively little while retaining an undesirable concentration, and one sparse ring can also move substantially more than a simple average suggests. Select the design from both change cost and steady-state workload. These are placement observations; an application comparison additionally includes copying, stale-map handling and recovery. Holding the inputs fixed makes each difference attributable to a declared rule rather than an accidentally changed population.
A practical report should retain both the expected changed-owner set and observed workload distribution. Neither one alone certifies capacity use. This keeps a low-movement layout from being adopted without checking the steady-state cost it leaves behind.
Solve the inserted-interval exercise
With A=0, B=100, C=200 and new D=150, owners for positions 100,120,150,170,299 are B,D,D,C,A. Equality selects the point itself and the tail wraps to zero. D takes positions greater than one hundred through 150. Use the declared convention consistently rather than copying interval notation from another routing rule.
If the next three points all belong to physical A, they do not provide three independent node replicas. Point count and failure independence differ. Explain reassignment, distribution, live movement and replicated commitment separately. Rendezvous hashing next selects ownership by candidate scores instead of a ring while retaining those same boundaries.