Lesson 2.2• 6 min read
Availability patterns and failover
Active-passive standby versus active-active multi-master topologies.
What you will learn
- Compare active-passive and active-active failover by capacity, outage and risk.
- Size an active-active pool so the survivors carry the peak when one node fails.
- Contrast master-slave and master-master replication.
System redundancy and failover
To survive hardware failure, network disconnection, or data center maintenance without downtime, systems deploy redundant hardware paired with automated failover mechanisms.
Active-passive failover (master-standby)
In an active-passive configuration (also called master-slave failover), only the active server handles traffic:
- Heartbeats: The active and passive servers exchange heartbeats. If the heartbeat is interrupted, the passive server takes over the active server's IP address and resumes service.
- Hot or cold standby: How long the outage lasts depends on whether the passive server is already running ("hot" standby) or must start up first ("cold" standby).
- Capacity implication: Usable capacity is that of the single active node (). The standby is insurance.
- Risk of failover: Data can be lost if the active server fails before newly written data has been replicated to the passive one.
Active-active failover (load-shared)
In an active-active configuration (also called master-master failover), both servers handle traffic and share the load:
- Full capacity utilization: Total system capacity equals .
- Finding the servers: If the servers are public-facing, DNS must know the public IPs of both; if they are internal, the application logic must know about both.
- Graceful degradation: If one node crashes, traffic stops going to it and the survivors absorb the load.
- Sizing requirement ( redundancy): To avoid overloading the survivors when one node fails, the capacity of nodes must still exceed peak demand.
Either way, failover adds hardware and complexity.
Master-slave (primary-replica) vs master-master replication
- Master-slave: The master serves reads and writes and replicates writes to one or more slaves, which serve only reads. If the master goes offline, the system can keep running read-only until a slave is promoted or a new master is provisioned; promotion needs extra logic.
- Master-master: Both masters serve reads and writes and coordinate on writes, so the system keeps accepting writes if one fails. You need a load balancer or application logic to decide where to write, and most master-master systems are either loosely consistent (violating ACID) or have higher write latency from synchronization. Conflicts become more likely as you add write nodes and as latency grows. Chapter 4 covers replication in depth.
Active-passive heartbeat and promotion
Virtual IP (VIP) router192.168.1.100Routing to: Node A (Active)
Node A (primary instance)Active leader
Serving: 5,000 RPSHeartbeat: OK (10ms)
Node B (standby replica)Passive standby
Serving: 0 RPS (warm spare)Monitoring node A
Failover event:Normal operation: primary processes all 5,000 RPS. Standby consumes 0 user traffic, maintaining binlog sync.
- Traffic (5k RPS): 1 × Clients & Users
- Primary Active LB: 2 × Application Load Balancer
- Passive Standby LB: 2 × Application Load Balancer
- Compute Tier: 6 × App Compute Server
- Traffic (5k RPS) sends requests to Primary Active LB
- Primary Active LB sends requests to Compute Tier
- Passive Standby LB sends requests to Compute Tier
Key takeaways
- Active-passive runs on one node's capacity and fails over on a missed heartbeat; a hot standby shortens the outage, and writes not yet replicated can be lost.
- Active-active uses every node and degrades gracefully, but only if nodes still cover the peak ( sizing).
- Master-slave keeps writes on one master and can run read-only until a slave is promoted; master-master keeps accepting writes but is loosely consistent or slower to write, with more conflicts.
Sources
- System Design Primer: Availability patterns (fail-over)
- System Design Primer: Master-slave and master-master replication
Adapted from The System Design Primer by Donne Martin, licensed under CC BY 4.0. Changes were made.