SysDesign study
Offline — showing the cached copy.
Home / Software System Design / 6. Replication and consistency

6. Replication and consistency

One-liner. Copies buy availability and read scale, and sell you freshness.

Memorize

  • Leader–follower: writes to leader, reads from followers → replica lag (read-your-writes problems).
  • Multi-leader / active-active: conflict resolution needed (LWW, CRDT, version vectors).
  • Quorum: R + W > N gives strong-ish consistency; tune R/W for latency vs freshness.
  • CAP is about partitions: during a partition you choose consistency or availability.
  • PACELC adds the normal case: latency vs consistency even without failures.
  • Patterns: read-your-writes (route to leader after write), monotonic reads (sticky replica).
LEADER AND FOLLOWERS Writer Leader Follower A Follower B Readers
Leader and followers

Trap. "Read replicas give strong consistency" — they're asynchronous by default; you get lag. Do this. Ask what happens if a user reads 50 ms after writing.

Check

After a profile update, a user refreshes and sees old data. Reads go to a lagging replica. Cheapest correct fix?