Try
↑ ↓ move↵ openesc close

Interview prep / Replication and lag

Junior · Replication and lag · System design interview question

What is replication lag, and why does a follower fall behind the leader?

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

A strong answer

Replication lag is the gap between a write being committed on the leader and the same write being visible on a follower. It can be measured in time or as a number of log entries the follower has not applied yet.

Followers fall behind because the log has to travel over a network that takes time and takes a different time on each trip, because a busy follower applies entries slower than they arrive, and because entries are applied in order, so one delayed message holds up everything behind it.

Lag matters because a read from a follower can return data older than a write the client was told succeeded. Lag is a window, not a loss: the follower catches up once the burst passes. It grows with the write rate, with network delay, and with a follower busy on other work.

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