Lesson 2.2• 6 min read

Availability patterns and failover

Active-passive standby versus active-active multi-leader 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 single-leader and multi-leader 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

In an active-passive configuration, 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 (1×C1\times Cwhat its symbols mean). 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, both servers handle traffic and share the load:

  • Full capacity utilization: Total system capacity equals N×CN \times Cwhat its symbols mean.
  • 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. Losing a cache node loses no data, but that node's hits become misses that land on the database, so the database must have room for them.
  • Sizing requirement (N+1N+1what its symbols mean redundancy): To avoid overloading the survivors when one node fails, the capacity of N−1N-1 nodes must still exceed peak demand.

Either way, failover adds hardware and complexity.

Single-leader vs multi-leader replication

Older documents, the primer among them, call these master-slave and master-master replication.

  • Single-leader: The leader serves reads and writes and replicates writes to one or more followers, which serve only reads. If the leader goes offline, the system can keep running read-only until a follower is promoted or a new leader is provisioned; promotion needs extra logic.
  • Multi-leader: Both leaders 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 multi-leader 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.
Clients1× instanceLoad balancers2× instancesApp servers6× instancesClients1× instanceLoad balancers2× instancesApp servers6× instancesClients1× instanceLoad balancers2× instancesApp servers6× instances
Figure 2

An active-passive pair of load balancers in front of an active-active pool.

Follow a request from the clients: it reaches the active one of the two load balancers, which spreads it across six app servers. The passive one handles nothing; it exchanges heartbeats with the active one and takes over its IP address if they stop. The app servers show the other pattern, active-active: all six share the load, so if one fails the other five must still carry the peak.

  • Clients: 1 × Users
  • Load balancers: 2 × Load balancer
  • App servers: 6 × App server
  • Clients sends requests to Load balancers
  • Load balancers sends requests to App servers

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 N−1N - 1what its symbols mean nodes still cover the peak (N+1N + 1 sizing).
  • Single-leader replication keeps writes on one leader and can run read-only until a follower is promoted; multi-leader keeps accepting writes but is loosely consistent or slower to write, with more conflicts.
Sources3