Try
↑ ↓ move↵ openesc close

Interview prep / Replication and lag

Junior · Replication and lag · System design interview question

Compare synchronous and asynchronous replication. What does each cost and what does each protect?

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

A strong answer

In asynchronous replication the leader tells the client yes once the write is on its own disk and sends it to followers afterwards. Writes are fast and do not depend on the network. If the leader fails before sending, acknowledged writes are lost, and follower reads can be stale.

In synchronous replication the leader waits for followers before answering. Nothing acknowledged is lost when the leader fails and followers are up to date. But each write now includes a round trip, and one slow or unreachable follower slows or blocks every write.

The trade, in plain terms, is durability and freshness against latency and availability. Semi-synchronous sits between the two: one follower is kept in step, so every acknowledged write is on two machines and only one extra round trip is paid.

Sources

Learn it by running it

The replication and lag 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