Failover & Redundancy
Overview
Failover is the automatic switching to a redundant or standby computer server, system, hardware component or network upon the failure or abnormal termination of the previously active application. Redundancy is the duplication of critical components or functions of a system with the intention of increasing reliability of the system, usually in the form of a backup or fail-safe.
Key Concepts
Redundancy Types
- Active-Passive (Master-Slave): One node handles all requests. The passive node continuously syncs state but does not serve traffic. If the active node fails, the passive node takes over.
- Active-Active (Multi-Master): Multiple nodes handle requests simultaneously. They must coordinate state (often via consensus algorithms or multi-master replication). If one fails, the others simply take more load.
Failover Mechanisms
For failover to occur, the system needs to detect the failure (typically via heartbeats or health checks) and then route traffic to the healthy node. This can be done via DNS (slow, due to caching) or a load balancer / virtual IP (fast).
Trade-offs
Redundancy inherently increases costs (you are paying for hardware/compute that may sit idle in an Active-Passive setup). Active-Active maximizes resource utilization but dramatically increases system complexity, especially regarding data consistency and conflict resolution. Fast failover requires aggressive health checks, which can lead to "flapping" if the network is unstable, causing unnecessary failovers.
Interview Tips
- Always eliminate single points of failure (SPOF) in your architecture diagrams by drawing at least two of everything (two app servers behind a load balancer, master-slave DB setup).
- Discuss how state is synchronized in redundant setups (synchronous vs asynchronous replication) and how it affects failover data loss.
Summary
- Redundancy eliminates single points of failure by duplicating components.
- Failover is the process of switching traffic to a redundant component when the primary fails.
- Active-Passive uses a standby node; Active-Active uses multiple working nodes.
- Load balancers and Virtual IPs are the best ways to manage failover routing quickly.