Quorums and Tunable Consistency

Topics Covered

The Quorum Condition

Three numbers

Why overlap matters

Common configurations

Tolerating failures

Versions decide the winner

Probabilistic intuition

Quorums as a spectrum

Where quorums came from

Weighted votes

Checking the condition in practice

Quorums and durability

The previous lesson introduced leaderless replication, where each write goes to several replicas and each read asks several replicas. The obvious question is how many is enough. If a write reaches only some replicas and a read asks only some replicas, when is the read guaranteed to see the write? The answer is the quorum condition, one of the most useful and most misunderstood ideas in distributed systems. This lesson explains the condition, how to tune it, where it falls short and how quorums appear inside consensus protocols.

Three numbers

A quorum system is described by three numbers. The replication factor n is the number of replicas that store each key. The write quorum w is the number of replicas that must acknowledge a write before it counts as successful. The read quorum r is the number of replicas that must respond to a read before the client picks the newest value among their responses. All three are usually configurable, n per table or keyspace and w and r per request in systems such as Cassandra, which call them consistency levels.

Why overlap matters

The key idea is overlap. If every successful write reached w replicas and every read asks r replicas, and w plus r is greater than n, then the set of replicas that acknowledged the write and the set that answered the read must share at least one replica. There are only n replicas, so two sets whose sizes add up to more than n cannot be disjoint. That shared replica has the latest value, and since the read compares versions and picks the newest, the read returns the latest successful write. This is the quorum condition: w plus r greater than n.

When the write set and the read set together are larger than the number of replicas, they must share a replica, and that replica carries the latest value.

Common configurations

The most common configuration is n equal to three, w equal to two and r equal to two. Two plus two is four, greater than three, so reads see the latest write. The system tolerates one unavailable replica for both reads and writes, since two of three remain. With n equal to five, w equal to three and r equal to three, the system tolerates two unavailable replicas. These are majority quorums: w and r are each more than half of n, so any two quorums overlap and any minority can fail.

Other combinations are valid too. With n equal to three, w equal to three and r equal to one, writes must reach every replica, so any single replica has the latest value and reads can ask just one, making reads fast at the cost of writes failing if any replica is down. With w equal to one and r equal to three, writes are fast and always available, while reads must ask every replica. The condition only requires that w plus r exceeds n; how the sum is split is a choice about which operation should be cheaper and more available.

Tolerating failures

A quorum operation succeeds as long as enough replicas are reachable. Writes need w of n, so they tolerate n minus w unavailable replicas. Reads need r of n, so they tolerate n minus r. With n equal to three and majority quorums, both tolerate one failure. If two replicas are down, both reads and writes fail, since neither can gather two responses. Choosing n and the quorums is therefore also choosing how many failures the system survives while staying consistent. Adding replicas increases fault tolerance but also increases storage cost and the work per write.

Versions decide the winner

The overlap guarantees that at least one replica in the read set has the latest value, but the reader still needs to know which response is newest. This is why every value carries a version: a timestamp in Cassandra, a version vector in Riak or a sequence number assigned by some coordinator. The read compares versions and returns the highest. If versions are timestamps from unsynchronized clocks, the newest write may carry a lower timestamp than an older one, and the read may pick the wrong value even with perfect overlap. Quorum correctness therefore depends on versions being ordered correctly, not just on the arithmetic.

Probabilistic intuition

Even when w plus r is not greater than n, reads usually return recent values, because writes propagate to all replicas within milliseconds in the common case. Research on probabilistically bounded staleness at Berkeley measured that with n equal to three and w equal to r equal to one, reads in typical deployments returned the latest value with very high probability after only a few milliseconds. This explains why many systems run with weak quorums in practice without obvious problems. It does not provide a guarantee, though: during failures, overload or network problems, the window can stretch to seconds or longer, exactly when correctness matters most.

Quorums as a spectrum

It is useful to think of w and r as dials. Turning both up toward n gives the strongest freshness and the least availability, since every replica must respond. Turning both down toward one gives the best availability and latency with no freshness guarantee. Majority quorums sit at the balanced point where freshness is guaranteed and a minority of failures is tolerated. Most systems let operators choose per request, so the same table can serve a fast, possibly stale read for a dashboard and a fresh read for a checkout page.

Where quorums came from

Quorums predate Dynamo by decades. David Gifford described weighted voting for replicated data in 1979, assigning each replica a number of votes and requiring read and write quorums whose vote totals together exceed the total, which is the same condition with weights. Thomas proposed majority consensus for replicated databases the same year. The idea resurfaced in the 2000s when large internet companies needed highly available storage across many cheap machines, and Dynamo made tunable n, w and r a practical, configurable feature. Knowing this history helps explain why the condition is phrased so generally: it was designed for any assignment of votes, not only for equal replicas.

Weighted votes

Weighted voting is still useful. A replica on a more reliable or better connected machine can carry two votes and others one, so that quorums can be formed with fewer but stronger replicas. A replica in a remote region can carry zero votes, receiving data asynchronously for local reads while never being needed for a quorum, which keeps cross region latency out of the critical path. Most modern systems use equal votes for simplicity, but MongoDB replica sets, for example, still let operators give members zero votes or priority zero to keep them out of elections.

Checking the condition in practice

When reviewing a design or a configuration, check the condition concretely for every pair of paths that must see each other. List each write path with its consistency level and each read path with its level, compute w plus r for each pair against the replication factor of the table and flag pairs where the sum does not exceed n. Repeat for each data center if levels are local. This simple audit catches the most common quorum bug, a read path that was weakened for performance while the matching write path was left alone, or the reverse.

Quorums and durability

The quorum condition is about freshness, but w also determines durability. A write acknowledged by w replicas survives the loss of any w minus one of them. With w equal to one, losing a single machine at the wrong moment loses the write. With w equal to two, a single failure is survivable. Durability also depends on what acknowledgment means: whether the replica flushed the write to disk or only to memory. Cassandra replicas, for example, acknowledge after writing to the commit log, whose flush behavior is configurable, periodic by default, so an acknowledged write can be lost if every acknowledging replica loses power within the flush interval.

Overlap is the whole trick

A write acknowledged by w replicas and a read from r replicas must share a replica when w plus r is greater than n, so the read sees the latest write as long as versions are ordered correctly. Majority quorums give that overlap while tolerating any minority of failures.