NoSQL · Data models beyond tables
How does replication work and what does it protect against?
Short answer
Replication keeps copies of data on multiple nodes for availability, durability and read scale. Leader-follower, multi-leader and leaderless models differ in who accepts writes and how conflicts are resolved.
A replica is a copy that can serve reads, take over after a failure, or both. Synchronous replication acknowledges a write only after replicas confirm it, which improves durability but adds latency. Asynchronous replication is faster but can lose recent writes on failover.
Topologies
- Leader-follower: one node accepts writes and followers replicate; simple but failover promotes a follower
- Multi-leader: several nodes accept writes; needs conflict resolution and is harder to reason about
- Leaderless: clients write to several replicas and use quorums; no single failover point
- Quorum systems trade latency for consistency by choosing how many replicas must respond
N = 3 replicas
W = 2 write acknowledgements
R = 2 read responses
R + W > N, so reads and writes overlap on at least one replica
W = 1, R = 1 is fast but can read stale or lose data
W = 3, R = 1 is durable on write but fails if any replica is downReplication lag is the gap between the leader and its followers. It affects read-your-writes, backup consistency and failover data loss. Monitor it as a first-class metric rather than assuming replication is instantaneous.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between synchronous and asynchronous replication?
- 2How does failover work in a leader-follower system?
- 3What is replication lag and how do you handle it?
- 4Why is replication not a backup?
Say it in the interview
Replication keeps copies on multiple nodes so the system survives failures and can scale reads. With a leader, writes go to one node and followers replicate, so failover promotes a follower. With leaderless quorums, the read and write counts determine whether clients see fresh data. I watch replication lag because it affects read-your-writes and how much data a failover might lose. I also keep real backups, since replication copies mistakes as faithfully as it copies good writes.
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 NoSQL mock interview and get scored feedback on depth, clarity and confidence.