Overview
Curated: · Written: · Reviewed:
High Availability & Disaster Recovery
In one line
HA keeps a business function running through the component failures the design expects. DR restores it after a disruption the design did not absorb. Fix RTO and RPO per declared scenario first, because they decide which replication, backup and failover pattern you need.
Key definitions
- RTO: maximum acceptable time from disruption to restored service, measured against a stated definition of 'restored' (serving, or serving normally).
- RPO: maximum acceptable gap between the last recoverable write and the disruption.
- Failure domain: the scope one fault takes down together: host, zone, region, account, identity provider, DNS control plane, deployment wave.
- Fencing: rejecting writes from a stale leader, usually by a monotonic token that the storage layer checks.
- Split brain: two nodes accepting writes as primary at the same time.
- Correlated failure: redundant copies that fail together because they share a domain or dependency.
Formulas and complexity
Quote downtime budgets on one basis only. 99.9% is about 8h 46m per 365-day year, or 43m 12s per 30-day month. The two bases do not reconcile.
Sizing for one zone loss in a three-zone service: each survivor must carry peak divided by two. At 1,000 rps per instance, that is 45 instances per zone.
How it works
- Spread stateless capacity across zones, sized so the survivors carry peak without the lost zone.
- Synchronous replication bounds acknowledged-write loss to zero but adds commit latency. Asynchronous replication adds lag, and that lag is the RPO.
- Replicas copy deletes and corruption. Backups must be isolated, versioned and restore-tested.
- Promotion needs fencing, a replication-position check against RPO, dependency health and capacity before traffic moves.
When to use and when not to
| Pattern | Use when | Avoid when |
|---|---|---|
| Backup and restore | RTO and RPO in hours, low steady cost | RTO in minutes |
| Pilot light | Data replicated, app tier created on declaration | Serving needed within minutes without scale-up |
| Warm standby | Full stack at reduced capacity, scale-up acceptable | Standby capacity cannot be funded |
| Active/active | Fast failover and conflict resolution designed in | Single-writer data with no conflict rule |
| Synchronous replication | RPO of zero, cross-site latency acceptable | Commit latency budget is tight |
| Asynchronous cross-region | Distance matters, availability first | RPO near zero is required |
Traps interviewers probe
- Starting the RTO clock at declaration or detection. Fix: start at disruption and report each step's timestamp, because the MCQ timeline runs from 09:00 onward.
- Treating HTTP 200 as availability. Fix: measure the business operation with correctness checks. Stale balances served with 200 still fail the function.
- Counting replicas in one zone as HA. Fix: place copies in independent zones and check shared power, network, control plane and deploy wave.
- Assuming synchronous replication meets the downtime target. Fix: state RPO and RTO separately. A scripted 45-minute failover misses a 30-minute downtime budget even with zero data loss.
- Promoting without fencing. Fix: take the lease through the quorum and let storage reject the old writer's lower token. A local promote command does not consult the quorum.
Interview tips
Open with: 'HA absorbs expected failures inside the design. DR recovers after the design is exceeded. I would fix RTO and RPO per scenario before choosing a pattern.'
Expect these follow-ups: how you prove the RPO (the replication lag at failover, measured); how you prevent split brain (leases, fencing tokens, quorum); what happens when the control plane is down (use data planes that are already running); how you fail back (reconcile, then shift traffic progressively).
30-second outline: define the failure scope; state RTO and where it is measured; state RPO and the replication mode that sets it; name the promotion gate (fence, check position, check dependencies); say how you test it and which numbers you record.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.