SimuVedaSystem Design Lab Open in the lab

Scaling data / Advanced / 8 min

Replication and quorums

Pick N, W and R. Watch stale reads appear and vanish, and what a failed replica does to availability.

Start the simulation → Change the load, break a part, watch what happens. Free, no sign-up.

In short

What it is
Each piece of data is copied to N replicas; a write needs W of them to confirm and a read asks R of them.
Why it matters
Copies survive machine and region failures and let more machines serve reads.
The trade-off
If W + R > N every read sees the latest write but is slower; smaller W and R are faster but reads can be stale (eventual consistency).
Say it in an interview
"With N = 3, W = 2, R = 2 the read and write sets always overlap, so reads are never stale and one node can be down."

Check yourself

N = 3. Which W and R guarantee a read sees the latest successful write?

Answer: W = 2, R = 2. You need R + W > N, so every read set overlaps every write set in at least one replica. 2 + 2 = 4 > 3.

N = 3, W = 3. One replica fails. What happens to writes?

Answer: They are rejected until the replica returns. Writes need acknowledgements from all three replicas, so losing one makes writes unavailable.

What does read repair do?

Answer: When a read sees an old copy, it writes the newer value back to that replica. Reads compare versions from several replicas and fix the out-of-date ones on the spot.

See it happen in the simulation →

quorumconsistencycapdynamo

More in scaling data