Read and Write Quorums Explained
On this page
Why W + R > N guarantees overlap
Store each item on N replicas. A write succeeds once W replicas acknowledge it; a read asks R replicas and returns the newest version among their answers. If
W + R > N
then every set of R replicas you read from shares at least one replica with every set of W that acknowledged the latest write. The read is guaranteed to see that write (as long as versions can be compared).
Tuning N, W and R
With N = 3:
| W | R | W + R > N? | Behavior |
|---|---|---|---|
| 2 | 2 | Yes | Balanced; tolerates one slow or down replica for both reads and writes |
| 3 | 1 | Yes | Fast reads; any replica down blocks writes |
| 1 | 3 | Yes | Fast writes; any replica down blocks reads |
| 1 | 1 | No | Fastest and most available; reads may be stale |
How many failures can you tolerate? Writes need W live replicas, reads need R: with N = 3, W = 2, R = 2, one replica can be down. With N = 5, W = 3, R = 3, two can be down.
Latency follows the slowest replica you wait for. Waiting for 2 of 3 lets you ignore the slowest replica, which is a big help for tail latency.
When quorum reads can still be stale
W + R > N gives overlap, but not linearizability on its own:
- Concurrent writes: two clients write the same key at once; replicas may receive them in different orders. You need conflict detection and resolution (Day 10).
- Partially failed writes: a write reaches 1 of the required 2 replicas, then fails. It's reported as failed but isn't rolled back; later reads may or may not see it.
- Read racing a write: a read during an in-progress write can see the new value on one replica and the old elsewhere; another read moments later might return the older value. Read repair (writing the newest value back to stale replicas during a read) narrows this.
- Sloppy quorums: when the item's home replicas are unreachable, some systems accept writes on other nodes temporarily (hinted handoff) to stay available. During that time, a read quorum might not overlap the write quorum at all.
Quorums versus consensus
Consensus protocols such as Raft and Paxos (Days 15 and 16) also use majorities, but add a leader, a single ordered log, and rules about terms. Together these give linearizable writes, which plain read/write quorums don't. Quorum stores like Cassandra trade that guarantee for availability and simpler operation; Cassandra offers lightweight transactions (Paxos-based) for operations that need it.
Quorums in Cassandra, DynamoDB and Riak
Cassandra exposes the choice per query (ONE, QUORUM, ALL, and LOCAL_QUORUM to keep quorums within one data center). DynamoDB's strongly consistent reads and Riak's tunable r/w values are the same idea.
Check yourself
W = 3 and R = 3. Since 3 + 3 > 5, every read set overlaps every write set in at least one replica, and each operation needs only 3 of the 5 replicas, so up to two can be down for both reads and writes.
Overlap ensures a read reaches a replica with the latest acknowledged write, but concurrent writes, writes that partially failed, and reads racing with a write in progress can still show anomalies, such as one reader seeing a new value and a later reader the old one. Linearizability needs ordering mechanisms like consensus.
Accepting writes on substitute nodes when home replicas are unreachable; it improves availability but means read and write quorums may not overlap until hinted data is handed back.
Very fast writes that succeed while any replica is up, but reads must reach every replica, so a single unavailable replica blocks reads.
QUORUM for both reads and writes, so read and write sets overlap across all replicas. LOCAL_QUORUM gives the same overlap within one data center, avoiding cross-region latency, at the cost of weaker guarantees across regions.