Switch to a backup when the main system fails: active-passive and active-active.
Failover means that when the main part of a system fails, a backup takes over automatically, so users see little or no break in service.
Every machine fails some day. Failover is the plan for that day. You keep a spare, you have a way to detect that the main one is gone (usually with heartbeats: small "I am alive" messages), and you redirect traffic to the spare (by moving a virtual IP, changing a DNS record, or telling the load balancer to stop using the dead machine).
The total break users feel is: time to detect + time to switch. Detection is a trade-off. If you wait for many missed heartbeats you avoid false alarms but users wait longer. If you react to one missed heartbeat, a short network hiccup can trigger a needless switch.
| Active-passive | Active-active | |
|---|---|---|
| Who serves traffic | Only the active node | All nodes |
| On a failure | Detect, promote the standby, redirect | Remove the failed node, the others absorb the load |
| Typical downtime | Seconds to minutes, depends on the standby | Often none, or only until the health check notices |
| Spare capacity | A whole machine sits idle | Every node must keep headroom |
| Data | Standby copies data from the active one | Data must be shared or replicated both ways, and conflicts handled |
| Complexity | Simpler. Watch out for split brain | Harder. Needs a good load balancer and data design |
| Standby | State | Takeover time | Cost |
|---|---|---|---|
| Hot | Running, data kept in sync all the time | Seconds | Highest (a full machine, always on) |
| Warm | Running, but data is a little behind or services are not all started | Tens of seconds to minutes | Medium |
| Cold | Switched off or empty. Must be started and loaded from backups | Minutes to hours | Lowest |
Illustrative model: each machine serves 100 req/s, takeover times are made-up round numbers (hot 2 s, warm 20 s, cold 90 s), and no random numbers are used. Real systems differ.
| Term | Meaning in easy words |
|---|---|
| Failover | Automatically switching to a backup when the main part fails |
| Failback | Moving back to the original node after it is repaired |
| Active-passive | One node serves, a standby waits and takes over on failure |
| Active-active | All nodes serve at the same time, and the survivors absorb a failed node's load |
| Hot / warm / cold standby | How ready the backup is: running and in sync, partly ready, or switched off |
| Heartbeat | A small regular message that says the sender is alive |
| Failure detection | How the system decides that a node is dead (for example, 3 missed heartbeats) |
| Virtual IP | An address that can be moved to another node, so clients do not need to change anything |
| Split brain | Two nodes both believe they are in charge, and both accept writes |
| Fencing | Blocking the old active node from writing after a new one took over |
| RTO / RPO | How long you can be down (recovery time) and how much data you can lose (recovery point) |
| Choice | We gain | We lose |
|---|---|---|
| Hot standby | Takeover in seconds | Pay for a machine that is idle most of the time |
| Cold standby | Cheap | Long outage while it starts and loads data |
| Quick detection | Short outage | More false alarms and needless switches |
| Slow detection | Few false alarms | Users wait longer before the switch |
| Synchronous copy to the standby | No data loss on failover | Slower writes, and a slow standby slows the active node |
| Asynchronous copy | Fast writes | The newest writes may be lost on failover |
| Active-active | Use all hardware, almost no downtime | Harder data design and needs headroom |