Replication buys read throughput and charges you in staleness
Replication buys cheaper reads by copying writes to machines that may lack them, so the cost arrives as staleness or as write latency.
A replica is a copy one step down the cost ladder. The leader settles a write on its own disk and acknowledges the client, and followers apply the log later. Reads from a follower are cheap and scale with the number of followers. The price is that a reader can miss a write the reader just made, and a failover can drop acknowledged writes that the surviving follower never received.
Single-leader replication sends every write to one node. The leader appends the write to its log and acknowledges the client. Followers receive that log in order and apply it to their own copies. Asynchronous mode acknowledges before any follower has the entry, so the client's success means one machine holds the write. Synchronous mode waits for a follower and pays one network round trip on every commit. Reads can go to any follower, which is why read throughput scales with the follower count. Writes cannot scale that way, because every one of them still lands on the leader. Each follower remembers the last log position it applied, and the gap between that position and the leader's position is the lag.
The abstraction hides the moment a leader dies. Suppose the leader is at log position 80 and a follower has applied only through 70. The leader acknowledged writes 71 through 80 to clients. If the follower is promoted, those ten writes do not exist, and the clients who received success have no way to know. No component reports the loss, because the system did what its settings said. Staleness is the visible symptom: a reader on the lagging follower sees old data and may notice. Loss stays silent. Lag climbs from milliseconds to seconds under load, and a backlog on one long link harms only the users whose writes sit in it, so a dashboard can look green while one region is wrong.
Decide per read path before you choose a topology. Ask three questions for each one. First, may this read be stale, and by how much? If the answer is no, send it to the leader. If the answer is a few seconds, send it to a follower and check a position or version. Second, may this write be lost on failover? If not, use synchronous replication for that data, and accept one round trip per commit. Third, where does the copy live? Put followers near the readers who tolerate staleness, and keep the leader near the writers. Then monitor lag as seconds behind the leader, not as up or down. Alert when the number crosses the bound the read path set for itself.
- replication lag
- milliseconds to seconds
- synchronous commit
- one network round trip
- majority quorum
- more than N/2
- election timeout
- hundreds of milliseconds
The distance between leader and follower log positions, which grows under heavy load.
The extra wait on every commit while the leader holds for a follower.
The replicas that must hold an entry before it counts as committed.
The silence a follower tolerates before it starts an election.
Copying a database across machines looks like copying files. The naive design ships pages to a replica, which applies them, while the leader acknowledges the client as soon as its local write finishes. The wall appears at failover: the follower is behind, so the promoted node lacks writes the client already saw succeed, and the client cannot tell.
The fix changes what counts as committed. An entry is committed only after a majority holds it in their logs, and a candidate must hold the most up-to-date log to win a majority of votes. Together those rules mean every new leader already carries every committed entry.
The non-obvious lesson is that replication does not make writes durable; a quorum does. A single follower copy only moves the risk until that follower falls behind. The election rule is what turns a copy into a promise.