System Design · Architecture under constraints

How does database replication work and what consistency issues does it create?

Mediumreplicationreplication lagfailoverUpdated Oct 2026
Quiz this track

Short answer

Replication copies data from a leader to followers. Asynchronous replication risks stale reads and lost writes on failover, while synchronous replication trades latency and availability for durability.

Replication keeps multiple copies of the data for durability, read scaling and failover. In leader-follower replication, all writes go to the leader and followers apply the write log. Reads can be served by followers, but only if the application can tolerate the delay before a follower catches up.

Replication modes

  • Asynchronous: the leader acknowledges before followers apply, so failover can lose recent writes
  • Synchronous: the leader waits for at least one follower, which improves durability but adds latency and can block on a slow replica
  • Semi-synchronous: wait for one replica, not all, as a middle ground
  • Multi-leader: writes accepted in several regions, requiring conflict resolution
  • Leaderless: quorum reads and writes across replicas, as in Dynamo-style stores

Replication lag creates visible anomalies. A user updates a profile, then reads from a lagging replica and sees the old value. Read-your-writes fixes this by routing a user's reads to the leader or to a replica known to have applied the write, often tracked with a log sequence number or a session token.

Failover is where replication gets dangerous. Promotion must ensure the chosen follower has all acknowledged writes, otherwise data is lost. Two leaders can accept conflicting writes during a partition, producing split brain. Use fencing, quorum-based election and a clear rule for which node may accept writes.

Replication does not increase write capacity; every replica applies the same writes. It helps read throughput, availability and durability. Write scaling needs partitioning or sharding.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1How do you guarantee read-your-writes with asynchronous replicas?
  2. 2What is split brain and how do you prevent it?
  3. 3Why does synchronous replication reduce availability?
  4. 4How does replication differ from sharding?

Say it in the interview

Replication copies data to followers for read scaling, durability and failover. Asynchronous replication is fast but can serve stale reads and lose recent writes when a lagging follower is promoted. I handle that with read-your-writes routing, log position tracking and a promotion rule that only chooses a replica with all acknowledged writes. Replication does not scale writes, so I keep that separate from sharding.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live System Design mock interview and get scored feedback on depth, clarity and confidence.