System design · interactive
Replication and stale reads
One database becomes three: a leader takes the writes and copies them to two followers, which serve reads. The copy takes time. Change your name from “Sam” to “Sara”, read it back, and see what you get.
Client
got OK
Leader
name = Sara
Follower 1
name = Sam
Follower 2
name = Sam
Tick 0: The leader writes “Sara” and confirms at once. The followers still say “Sam”.
Leader confirms the write
Your next read goes to
Step 1 of 5 · read left to right
In production
Tools and technologies
Every major database ships leader–follower replication; the knobs are sync vs async and where reads go.
Not tied to one language — use these names when you search docs or design a system.
- PostgreSQL streaming replicationSoftware
WAL shipped to standbys; synchronous_commit picks sync or async.
GitHub ↗ - MySQL replicationSoftware
Binlog replication, with semi-synchronous mode.
GitHub ↗ - Amazon RDS read replicasService
Managed async replicas and Multi-AZ failover.
Official site ↗ - MongoDB replica setsSoftware
Write concern and read preference control durability and staleness.
GitHub ↗