Failover

On this page 7

Failover is the process of moving a service from a failed or unhealthy component to a standby component so that clients can continue to use it with minimal interruption. In server reliability, failover is the mechanism that turns redundancy into actual high availability: spare servers, databases or network paths add value only if traffic and state can move to them correctly when the primary fails.

A failover can be automatic, triggered by health checks and cluster software, or manual, initiated by an operator. Its quality is measured by how quickly service resumes, which relates to the RTO, and how much recent data survives the switch, which relates to the RPO.

How failover detects a failure and switches over

Every failover follows the same four-stage sequence: detect the failure, decide that a switch is justified, promote the standby, and redirect clients to it. Each stage adds delay, and the total of those delays is the failover time that users experience.

StageWhat happensTypical duration
DetectionHeartbeats or health checks stop succeedingA few seconds to about 30 s
DecisionCluster confirms the failure and reaches quorumUnder a second to several seconds
PromotionStandby takes the role, replays logs, starts servicesSeconds to minutes
RedirectionVirtual IP, DNS or load balancer points to the new nodeInstant to minutes, DNS TTL dependent
Stages of a typical failover

Detection relies on a heartbeat interval and a failure threshold, for example three missed checks at five-second intervals. Short thresholds speed up failover but raise the risk of false positives caused by a brief network hiccup or a long garbage-collection pause, so tuning is always a trade-off between speed and stability.

Failover configurations and their trade-offs

The architecture of the standby determines how fast and how safely failover can happen. The main configurations differ in how warm the standby is and whether it already serves traffic.

ConfigurationStandby stateTypical failover timeMain trade-off
Active-passive (hot standby)Running and continuously synchronizedSecondsIdle capacity costs money
Warm standbyRunning with periodic sync or reduced capacityMinutesSome data loss and scale-up needed
Cold standbyProvisioned but stopped or restored from backupHoursCheap but slow
Active-activeServes traffic at all timesNear zero for stateless trafficComplex state and conflict handling
Common failover configurations

Replication mode matters as much as topology. With synchronous replication, a write is confirmed only after the standby has it, so the RPO can be zero at the cost of higher write latency. With asynchronous replication, writes are faster, but the most recent transactions may be lost during failover.

Failover is frequently used as a synonym for neighboring terms, but each describes a different part of reliability engineering. The distinctions below help when writing runbooks or service-level objectives.

TermWhat it describesRelation to failover
RedundancyDuplicate componentsThe precondition that makes failover possible
High availabilityA design goal for minimal downtimeFailover is one of its main mechanisms
FailbackReturning service to the original primaryThe planned reverse step after repair
SwitchoverA planned role change with no failureSame mechanics, controlled timing, no data loss
Disaster recoveryRestoring service after a site-level lossOften involves cross-region failover
Failover and related reliability terms

Failover protects against component failure, but it does not protect against logical errors. If an application deletes data, replication copies the deletion to the standby within seconds, which is why failover never replaces backups and restoration tests.

Split brain and other failover risks

The most dangerous failover failure is split brain: two nodes both believe they are primary and accept writes independently. When the network heals, the data has diverged and often must be reconciled manually. Clusters prevent this with quorum, typically requiring a majority of an odd number of voters, and with fencing, which forcibly isolates or powers off the old primary.

  • Untested failover: a procedure that has never run in production conditions often fails on configuration drift, expired credentials or missing capacity.
  • Flapping: aggressive thresholds cause repeated switches back and forth, each one interrupting clients.
  • Long DNS TTLs: clients keep connecting to the failed address for minutes or hours after the switch.
  • Undersized standby: a passive node that cannot carry full load turns a failover into an outage under heavy traffic.
  • Stale connections: connection pools and caches hold sockets to the old primary until timeouts expire.

Mature teams run regular failover drills, measure the real recovery time and compare it with the target RTO. A drill that reveals a problem in daylight is far cheaper than discovering it during an actual outage at night.

Designing failover for a server service

Failover design starts with the business targets: how much downtime and data loss are acceptable. Those targets then dictate replication mode, standby temperature and redirection method, rather than the other way around.

TargetRecommended approachReason
RTO in seconds, RPO zeroHot standby with synchronous replication and fencingOnly option that preserves every write quickly
RTO in minutes, small RPOWarm standby with asynchronous replicationLower cost and latency, minor data loss accepted
RTO in hoursCold standby or restore from backupCheapest option for non-critical systems
Stateless web tierActive-active behind a load balancerHealth checks remove failed nodes automatically
Choosing a failover approach by target

A plain-language summary

Failover is like a backup goalkeeper who steps in the moment the first one is injured. The game continues, perhaps after a short pause, because someone was ready to take over.

The backup is only useful if it is warmed up, knows the current score and can get onto the field quickly. In the same way, a spare server helps only if it is ready, synchronized and reachable when the main one fails.

An example from practice

An online retailer runs its order database as a primary and a hot standby in two data centers, with synchronous replication and a three-node quorum that includes a small witness server. Health checks run every five seconds, and three consecutive failures trigger promotion.

One evening a storage controller on the primary fails. The cluster fences the old primary, promotes the standby and moves the virtual IP address to it. Checkout is unavailable for about 25 seconds, no confirmed order is lost, and the team performs a planned failback two days later after replacing the controller.