Redundancy, failover and hidden single points of failure
Choose between active-passive and active-active, break failover time into detection, decision, promotion, redirection and warm-up, see with a seeded simulation why a lower detection threshold is not free, and find the shared parts, such as DNS, configuration, certificates, identity and control planes, that make redundant copies fail together.
Contentsand lesson path
On this page
- Why it matters
- Active-passive and active-active
- How long failover really takes
- Hidden single points of failure
- When redundancy is the wrong answer
- Check your understanding
- Apply it
- Review prompt
Lessons of Availability & Disaster Recovery
- Availability math: nines, dependencies and redundancy Worked example · 25 min
- Redundancy, failover and hidden single points of failure Concept · 20 min
- Multi-region designs, deployment stamps and their consistency cost Concept · 20 min
- RTO, RPO and choosing a recovery strategy Concept · 20 min
- Observability at scale: sampling, cardinality and telemetry cost Concept · 20 min
- Availability design check Knowledge check · 8 questions
What you will learn
- Design redundancy and failover (active-passive, active-active, multi-zone, multi-region, deployment stamps) and remove single points of failure, including DNS and control-plane dependencies.
01. Why it matters
Imagine a booking service with two of everything: two application servers per zone, a database primary with a standby in another zone, and a second region ready to take over. One morning every request fails in both regions at once. The cause is a TLS certificate: both regions served the same one, renewed by hand a year earlier, and it expired at 09:00.
Redundancy protects you from copies failing independently. It does nothing for a failure of something the copies share. In the previous lesson the shared part was a line in a formula; here it is a design problem. This lesson asks three questions: which redundancy shape fits a component, how long failover really takes, and where the shared parts hide.
02. Active-passive and active-active
Start with the honest baseline: one copy, restarted fast. For an internal tool with a 99.5% target (about 3.6 hours a month), a single virtual machine that restarts itself and a tested restore can meet the target at a fraction of the cost and complexity of redundancy. It stops working when the machine fails more often, or takes longer to replace, than the budget allows. That is when you add copies, in one of two shapes.
Active-passive: one copy serves; a standby takes over after a failover. The standby can be cold (must be started), warm (running, not serving) or hot (ready at full size). This shape suits components with one writer, such as a database primary, because only one copy accepts changes at a time. Its costs are idle capacity, the failover delay, and a standby path that rarely runs, so it can drift out of date unnoticed.
Active-active: every copy serves; losing one shifts its share to the others with no promotion step. This fits stateless tiers behind a load balancer. Two conditions matter. Each copy needs headroom: with two copies, each must run below half of its capacity, or the survivor overloads. And if the copies write shared state, you need partitioning or conflict handling, the topic of the next lesson.
Active-passive also has a classic trap. If the standby is promoted while the old primary is only unreachable, not dead, both may accept writes: split brain. The failover must make sure the old primary can no longer write: wait for its lease to expire, use a fencing token that storage checks, or require a majority quorum. Leaders, replicas and failover shows promotion in a database; distributed systems fundamentals covers leases and quorums.
03. How long failover really takes
The parallel formula from lesson 1 assumes instant failover. In practice failover has five parts, and each one is a number you can measure in a drill:
primary fails
|-- detect ---|-- decide --|-- promote --|-- redirect --|-- warm up --|
missed fence the standby DNS TTL, cold caches,
heartbeats old primary, replays its connection first queries
or checks wait for a log, starts pools, client slow
lease to end accepting caches
writes
service fully normal -->|Redirection is often the longest part: clients that cache DNS answers or hold open connections keep talking to the old address until the record's TTL (time to live: how long a cached answer may be reused) ends or the connection breaks (Global load balancing with DNS and anycast estimates this). Detection is the part teams tune first, and the one with a hidden price. The simulation below assumes a primary that sends a heartbeat every second and sometimes stalls harmlessly, for example in a garbage-collection pause. A stall longer than the threshold looks exactly like a crash, so it triggers a failover that costs 30 seconds of errors.
"""Failover detection: a lower miss threshold detects crashes sooner but turns
more harmless stalls (GC pauses, network blips) into needless failovers."""
import random
rng = random.Random(7)
INTERVAL = 1.0 # seconds between heartbeats
DAYS = 30
FAILOVER = 30.0 # seconds of errors while a replica is promoted and clients reconnect
# Assumed stall model: 30 stalls a day, heavy-tailed (most short, a few long).
stalls = [0.25 * rng.paretovariate(2.0) for _ in range(DAYS * 30)]
print(f"{len(stalls)} stalls in {DAYS} days, longest {max(stalls):.1f} (seconds)")
def error_minutes(crashes, detect, false_failovers):
return (crashes * (detect + FAILOVER) + false_failovers * FAILOVER) / 60
print(f"\n{'misses':>6}{'detect(s)':>10}{'false':>7}"
f"{'min, 1 crash':>14}{'min, 20 crashes':>17}")
for misses in (2, 3, 4, 6, 10):
threshold = misses * INTERVAL
false_failovers = sum(1 for s in stalls if s >= threshold)
detect = threshold + INTERVAL / 2 # a crash lands mid-interval on average
one = error_minutes(1, detect, false_failovers)
twenty = error_minutes(20, detect, false_failovers)
print(f"{misses:>6}{detect:>10.1f}{false_failovers:>7}{one:>14.2f}{twenty:>17.2f}")900 stalls in 30 days, longest 7.2 (seconds)
misses detect(s) false min, 1 crash min, 20 crashes
2 2.5 13 7.04 17.33
3 3.5 5 3.06 13.67
4 4.5 3 2.08 13.00
6 6.5 1 1.11 12.67
10 10.5 0 0.68 13.50Going from 10 missed heartbeats to 2 detects a crash 8 seconds sooner, but turns 13 harmless stalls a month into failovers. With one real crash a month, every lower threshold costs more error minutes than it saves. If you change the crash rate to 20 a month, faster detection starts to pay, and the best threshold moves lower, to 6 in this run. The right setting depends on how your real crashes compare with your harmless stalls, so measure both before tuning. Each false failover also carries split-brain risk, which no minute count shows.
Heartbeats have a blind spot too. They prove a process is alive, not that it serves requests correctly: a node with a failing disk can answer every heartbeat while timing out real queries. Detection that checks the real request path, such as the error rate of actual calls, catches much of what heartbeats miss.
05. When redundancy is the wrong answer
Every copy and every failover mechanism is new code that can fail. False failovers, split brain and failover bugs are outages that a simpler system would not have. Skip or postpone redundancy when the budget is generous (a 99% internal report tolerates hours of repair), when the work can simply be rerun later (a nightly batch job), or when the team cannot test the failover path regularly; an untested failover is a guess. For whole-region failover, the AWS disaster recovery whitepaper advises caution with automatic triggering because false alarms cost availability and data, and notes that many teams start failover by hand while automating every step behind the button.
06. Check your understanding
07. Apply it
For the checkout journey of the skill project:
- Choose active-passive or active-active for each of the five dependencies and say why, including where split brain could occur and what fences it.
- Estimate the failover time of the weakest component part by part, with an assumption for each part.
- List what the request path and the recovery path need: DNS, certificates, identity, secrets, configuration, control-plane calls. Mark each item that both regions or zones share.
- Pick the shared item with the widest reach, inject its failure on paper, and write down which copies fail together and what you would change.
08. Review prompt
Without looking back: when is active-passive a better fit than active-active, and what must happen to the old primary during failover? Name the five parts of failover time and explain why lowering the detection threshold is not free. Then name four kinds of hidden single point of failure and, for each, one change that keeps it from failing every copy at once.
References
- Static stability using Availability Zones (Amazon Builders' Library)
- AWS Fault Isolation Boundaries: global services
- Disaster recovery options in the cloud (AWS whitepaper)
- More details about the October 4 outage (Engineering at Meta, 2021)
- Treynor, Dahlin, Rau and Beyer: The Calculus of Service Availability (ACM Queue, 2017)
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.