Skip to main content
networking

Failover

Failover is the automatic transfer of traffic from a failed primary system to a standby replica. Database failover promotes a replica to primary. DNS failover routes to a backup IP. Load balancer failover removes failed backends. Recovery time (RTO) depends on detection speed and promotion mechanism – seconds for load balancer, minutes for database.

Definition

Failover maintains service continuity when the primary system fails by automatically activating a standby. Types: active-passive (standby is idle until needed – simple but wastes resources), active-active (all instances serve traffic – failure just reduces capacity), and warm standby (standby receives data but does not serve traffic – faster activation than cold). Database failover: PostgreSQL streaming replication promotes a replica to primary via pg_promote() or Patroni automation. Detection takes 10-30 seconds (missed heartbeats), promotion takes 5-30 seconds, and client reconnection adds seconds. Total RTO: 30-90 seconds typical. DNS failover: health checks detect the primary's failure, DNS records update to point to the backup. Effective only with low TTL (30-60 seconds) – clients with cached DNS may still route to the failed primary. Load balancer failover is fastest: health check fails, backend removed from pool within 10-30 seconds, traffic immediately reroutes to remaining healthy backends.

Examples

  • Patroni: automatic PostgreSQL failover with etcd/Consul consensus
  • Route 53: failover routing policy with health check (primary → secondary)
  • HAProxy: server primary 10.0.0.1:5432 check; server backup 10.0.0.2:5432 check backup

Related Protocols

Related Terms