Skip to main content

3 Quorum

You replicate data to 3 nodes for fault tolerance. A client writes a new value to Node A, but the write hasn't propagated to Nodes B and C yet. Another client reads from Node B and gets stale data. How do you guarantee that reads always see the latest write, without waiting for every replica to acknowledge?

Think first
You replicate data to 3 nodes. A write goes to Node A, but hasn't propagated to B and C yet. A read from Node B returns stale data. How would you guarantee reads always see the latest write without requiring all 3 nodes to participate in every operation?

Background

Replication creates copies of data for durability and availability. But it also creates a consistency problem: at any moment, different replicas may have different versions of the data. The question is: how many replicas need to participate in an operation before you can trust the result?

Definition

A quorum is the minimum number of nodes that must successfully complete a distributed operation (read or write) before the operation is considered successful. By requiring enough nodes to participate, you guarantee overlap between the nodes that stored a write and the nodes that serve a read.

The quorum formula

The magic formula is: R + W > N

VariableMeaning
NTotal number of replicas
WMinimum nodes that must acknowledge a write
RMinimum nodes that must respond to a read

When R + W > N, there's guaranteed overlap -- at least one node in every read quorum has seen the latest write. This gives you strong consistency.

Common configurations

ConfigurationBehaviorTrade-off
N=3, W=2, R=2Strong consistency, balanced read/write performanceMost common default
N=3, W=3, R=1Writes are slow (must hit all nodes), reads are fastGood for read-heavy workloads
N=3, W=1, R=3Writes are fast, reads are slowGood for write-heavy workloads (but fragile -- one node failure blocks reads)
N=3, W=1, R=1Fast everything, but no consistency guaranteeEventually consistent -- used when speed matters more than correctness
The intuition

Think of it like a Venn diagram. W is the set of nodes you wrote to. R is the set of nodes you read from. If R + W > N, these two sets must overlap. The overlapping node guarantees your read sees the latest write.

Strict quorum vs. sloppy quorum

Strict quorum

Reads and writes must go to the designated replica nodes for each key. If not enough designated replicas are available, the operation fails. This gives strong consistency but reduces availability during failures.

Sloppy quorum

If designated replicas are down, the system can write to any available node (not just the key's replicas). This keeps writes succeeding even during failures but sacrifices consistency -- the write might end up on a node that doesn't normally hold that key. The data is forwarded to the correct node later via hinted handoff.

Interview angle

Always clarify: "Are we talking about strict quorum or sloppy quorum?" Strict quorum gives you the R + W > N consistency guarantee. Sloppy quorum keeps the system available during failures but breaks that guarantee. Dynamo famously uses sloppy quorum -- it prefers to always accept writes, even at the cost of temporary inconsistency.

Examples

Cassandra

Cassandra makes quorum a first-class API concept. Every read and write specifies a consistency level:

  • ONE -- only one replica must respond (fast, eventually consistent)
  • QUORUM -- majority must respond (strong consistency with R + W > N)
  • ALL -- every replica must respond (strongest consistency, lowest availability)

This per-query tuning is one of Cassandra's most powerful features.

Dynamo

Dynamo uses a sloppy quorum. Writes go to the first W healthy nodes from the preference list (which may include nodes not normally responsible for that key). This means Dynamo always accepts writes, even during failures -- but the R + W > N guarantee doesn't strictly hold.

Chubby

Chubby uses Paxos, which requires a majority quorum for all writes. In a typical 5-node Chubby cell, writes need acknowledgment from at least 3 nodes. This gives Chubby its strong consistency guarantee.

Quiz
You have a system with N=3, W=1, R=1. A network partition splits the cluster so that Node A is isolated from Nodes B and C. A client writes to Node A. Another client reads from Node B. What happens?