Redundancy and Replication
How spare capacity and extra copies of data keep a system up and its data safe: failure domains, active-passive and active-active, replication topologies and timing, RPO and RTO, conflicts, and why replicas are not backups.
Overview
Redundancy means having more of something than you need, so that when one part fails another takes over. Replication is redundancy for data: keeping copies of the same data on several machines, so it survives the loss of any one of them and can be read from several places.
Together they are how systems reach high availability and durability. A stateless web server is easy to make redundant: run more copies behind a load balancer. Data is harder, because the copies must be kept in step, and every way of doing that trades something: write latency, the chance of losing recent writes, or conflicting updates that must be merged.
In interviews this topic is where designs are tested for failure. Interviewers ask what happens when a server, a zone or a region goes down, how much data you could lose, how long recovery takes, and how you know it works. Strong answers name the failure domain, the replication mode, the RPO and RTO, and the backups.
What you will be able to do
- Find single points of failure and size spare capacity so the system survives losing a zone.
- Place copies across failure domains, and choose active-passive or active-active.
- Compare single-leader, multi-leader and leaderless replication, and synchronous and asynchronous timing.
- Turn RPO and RTO targets into a disaster recovery strategy.
- Explain why replication does not replace backups.
Key concepts
- Single points of failure
- N+1 capacity
- Failure domains
- Active-passive and active-active
- Single-leader, multi-leader, leaderless
- Synchronous and asynchronous replication
- RPO and RTO
- Disaster recovery strategies
- Conflict resolution and CRDTs
- Backups
Interview questions
- How would you make a service survive the loss of a data center?
- What is the difference between synchronous and asynchronous replication, and how do you choose?
- Explain RPO and RTO, and give a design for an RPO of zero and an RTO of five minutes.
- Compare single-leader, multi-leader and leaderless replication.
- Two regions accept writes to the same record at the same time. What happens?
- We already have three replicas. Why do we need backups?
- How many replicas do you need, and where do they go?
- How do you know your failover actually works?
Sign up free to read the full topic
More System Design topics
Start free on Cariara · Coding problems · System design studio