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.
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.
Health Check
A health check is a periodic probe that determines whether a service instance is able to handle traffic. Load balancers, orchestrators (Kubernetes), and service meshes use health checks to route traffic only to healthy instances. Types: liveness (is the process alive?), readiness (can it serve requests?), and startup (has it finished initializing?).
High Availability (HA)
High availability is a system design that minimizes downtime by eliminating single points of failure. Measured in 'nines' – 99.9% (8.7h downtime/year), 99.99% (52min/year), 99.999% (5min/year). Requires: redundant components, automatic failover, health monitoring, and tested recovery procedures.
Disaster Recovery (DR)
Disaster recovery is the plan and infrastructure for restoring service after catastrophic failure (region outage, data center loss, ransomware). Defined by RPO (how much data loss is acceptable) and RTO (how quickly service must resume). DR requires cross-region replication, tested runbooks, and regular drills.