Try
↑ ↓ move↵ openesc close
Quorums2 / 7
In this lesson · topic 2 of 7
  1. 1. What if there is no leader
  2. 2. Overlap, and the k-th fastest reply
  3. 3. Tune R and W against slow and dead replicas
  4. 4. What R plus W above N still does not promise
  5. 5. Two writes at once, and which one wins
  6. 6. Merkle trees, expiring hints, and deleted data coming back
  7. 7. Check the quorum arithmetic

Topic 2

Overlap, and the k-th fastest reply

6 min read

The overlap rule

Take N replicas. A write is acknowledged by W of them, so those W hold the new value. A read asks R of them. If R plus W is greater than N, the read set and the write set cannot be disjoint, because together they would need more than N distinct replicas. At least one replica in the read set has the new value, and the reader picks the newest version among the answers.

This is the idea in Gifford’s paper on weighted voting. Step through a concrete case below.

Why R plus W above N makes reads see writes

Step 1 / 4
#1v1#2v1#3v1#4v1#5v1All replicas agree.outlined = asked by this operation
N
5
  1. Five replicas hold version 1

    N is 5. Every replica has the same value, version 1.

Common choices follow from the rule. With N equal to three, R and W both two is a majority quorum. With W equal to N and R equal to one, reads are cheap and writes need every replica. With R equal to N and W equal to one, the reverse.

A quorum waits for the k-th fastest reply

The coordinator sends the request to all N replicas at once, then waits until W replies for a write or R replies for a read. So the latency of an operation is the time of the k-th fastest reply, with k being W or R.

That has a useful consequence. If one replica is slow, a quorum smaller than the number of fast replicas never waits for it. And a harsh one. Ask for one more reply than there are fast replicas, and latency jumps to the slow replica’s, since there is nothing else to wait for.

Failures cost availability

A replica that is down cannot reply. An operation needs k replies, so it succeeds only if at least k of the N replicas are reachable. If each replica is unreachable with probability p, the chance of success is the chance that at least k out of N are up, which is a binomial tail. Larger k means a lower chance. Majority quorums survive a minority of failures. Needing every replica survives none.

Sloppy quorums and hinted handoff

Strict quorums insist that the replies come from the N replicas that own the item. A sloppy quorum relaxes that. When some owners are unreachable, the write goes to other healthy nodes, which count toward W. Those stand-ins keep a note of who the write was for. When the owner comes back, the stand-in hands it over. That is hinted handoff. Writes then succeed in far more situations.

The cost is the overlap guarantee. A read still asks the owners, and the write may be sitting on stand-ins that the read does not ask. R plus W can exceed N and a read can still miss the write, until the hint is delivered. A sloppy quorum is a choice for availability over freshness.

Read repair

Replicas that miss writes stay behind. Read repair closes the gap lazily. When a read sees that some replicas returned an older version, it writes the newest value back to them. Items that are read often get healed quickly. Items nobody reads stay stale, so systems also run a background pass that compares replicas, which is outside this lab.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms