0 day streak
9. Distributed systemsReplication and quorums

Replication and quorums

Replication means keeping copies of the same data on several machines, so you survive a machine dying and can spread reads across the copies. The common setup has a leader that accepts writes and followers that copy them. If followers copy asynchronously, the leader answers quickly but followers can lag, so a read from one may be stale, and a failover can lose writes that were already confirmed. Quorum systems take another approach: with N copies, a write waits for W of them to confirm and a read asks R of them. If R plus W is greater than N, every read group overlaps every write group in at least one copy, so a read always reaches a replica holding the latest write and can pick out the newest version.

In this lesson: Leader-follower with visible lag. Quorum sliders show stale reads appearing when R + W ≤ N.