Moving Beyond Binary Choices
CAP makes it sound like you must choose "total consistency" or "total chaos." Modern distributed databases like Apache Cassandra and Amazon DynamoDB give you a dial to turn. This is called Tunable Consistency — the ability to choose, per operation, how strongly consistent you want that operation to be.
The mechanism used to implement this dial is the Quorum. A quorum is the minimum number of nodes that must agree on an operation before it is considered successful.
We define three variables:
- N: The total number of nodes holding a copy of the data, also called the Replication Factor. If
N=3, every piece of data exists on 3 nodes. - W (Write Quorum): How many nodes must successfully acknowledge a write before the coordinator tells the client "Success"?
- R (Read Quorum): How many nodes must respond to a read request before the coordinator returns the most recent value to the client?
The Golden Rule of Strong Consistency
To guarantee that a read always sees the most recently written data, the following formula must hold:
$$R + W > N$$
Why does this work? If you write to W nodes and read from R nodes, and R + W > N, then by the pigeonhole principle, the set of nodes you read from must overlap with the set of nodes you wrote to. At least one node in your read set holds the newest data. The coordinator picks the response with the highest timestamp.
If R + W ≤ N, there is a chance your read set and write set have no overlap — you might read from nodes that haven't received the latest write yet. This is eventual consistency.
Common Quorum Configurations for N=3
| Configuration | R | W | R+W | Consistency | Use Case |
|---|---|---|---|---|---|
| Strong Consistency | 2 | 2 | 4 > 3 ✓ | Strong | Financial records, inventory |
| Write-optimized | 1 | 3 | 4 > 3 ✓ | Strong | Audit logs (fast reads, slow writes acceptable) |
| Read-optimized | 3 | 1 | 4 > 3 ✓ | Strong | Read-heavy, write-rare data |
| Eventual Consistency | 1 | 1 | 2 ≤ 3 ✗ | Eventual | High-throughput sensor ingestion |
| Balanced HA | 2 | 2 | 4 > 3 ✓ | Strong | Survives 1 node failure for both reads and writes |
The W=2, R=2 configuration with N=3 is the most common production default. It provides strong consistency and tolerates the loss of one node for both reads and writes simultaneously.