Failover

2 min read

Failover is a high-availability mechanism that automatically switches a system's operations to a standby or redundant component when the primary component fails, becomes unavailable, or degrades in performance. The goal is to ensure continuous service availability with minimal or zero downtime. When implemented correctly, failover is transparent to end users, who experience uninterrupted service even as backend systems recover from failures.

Failover can be implemented at multiple levels of the technology stack. Server failover redirects traffic from a failed application server to a healthy one using load balancers or DNS-based routing. Database failover promotes a replica database to primary status when the master goes down; systems like PostgreSQL streaming replication, MySQL Group Replication, and managed services like AWS RDS Multi-AZ handle this automatically. Network failover reroutes traffic through backup network paths, and geographic failover shifts operations to a different data center or cloud region entirely when a regional outage occurs.

There are two primary failover approaches:

  • Active-passive (hot standby): A standby system remains idle but ready, taking over when the primary fails. Simpler to implement but the standby resources sit unused during normal operations.
  • Active-active: Multiple systems simultaneously handle traffic, and if one fails, the remaining systems absorb its load. More resource-efficient and provides better performance, but requires more complex architecture to manage data consistency.

Effective failover requires regular testing. An untested failover strategy may not work when it's actually needed. Techniques like chaos engineering (popularized by Netflix's Chaos Monkey) deliberately introduce failures to validate that failover mechanisms work as expected. The best failover strategy is one you've proven works before a real incident forces you to find out.