Try
↑ ↓ move↵ openesc close

Interview prep / Quorums

Senior · Quorums · System design interview question

A leaderless store keeps three replicas in each of two data centres, 80 ms apart. Users read and write in their own region. Compare a global quorum with a per-data-centre quorum for the latency and the guarantees.

Sketch your own answer first, then compare it with the one below.

A strong answer

There are six replicas, so a global majority is four. Any operation must collect replies from at least one remote replica, since three local ones fall short. Every read and write therefore pays the 80 ms trip, and if the link between the centres is cut, neither side has four nodes, so both stop. In return, a global majority on both reads and writes keeps the usual overlap guarantee across the whole system.

A per-data-centre quorum needs only a majority of the three local replicas, two of them. Operations finish at local speed and keep working during an inter-region cut. The cost is in the guarantees. Within one region, a local read after a local write overlaps and sees it. Across regions, nothing forces the overlap, so a user in the other region can read stale data until asynchronous replication catches up. Two regions can also write the same key at the same time, which needs a conflict rule such as version vectors.

Most deployments choose the local quorum for normal traffic, because 80 ms on every operation is an expensive way to be safe. They keep a global quorum only for the few operations where cross-region freshness matters, and they accept that the data is only eventually consistent across regions.

Also decide how a user is routed. Pinning each user to a region restores read-your-writes for them.

Sources

Learn it by running it

The quorums lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms