Skip to content

Availability, Reliability and Fault Tolerance

Intermediate 56 min read Part 2 of 18

Availability vs reliability vs durability, nines and downtime budgets, series and parallel availability math, failover models, MTBF/MTTR and removing SPOFs.

Summary#

Three related properties are often confused:

  • Availability is the share of time, or of requests, for which a system answers successfully.
  • Reliability is whether it keeps doing the right thing over time.
  • Durability is whether data, once acknowledged as saved, survives.

Availability is measured in "nines": 99.9% allows about 43.8 minutes of downtime a month, and 99.99% only about 4.4 minutes.

The availability maths has two rules:

  • Components a request needs in series multiply their availabilities, so the total gets worse with every hop.
  • Redundant components in parallel multiply their failure probabilities, so the total gets much better.

Availability = MTBF / (MTBF + MTTR). Shortening the time to detect and repair (MTTR) is usually the cheapest way to gain nines.

The toolkit:

  • Remove single points of failure (SPOFs) by adding redundancy across independent failure domains.
  • Fail over automatically, either active-passive or active-active.
  • Decide deliberately whether each dependency fails open or fails closed.
  • Design for graceful degradation.

High availability means brief interruptions with fast recovery. Fault tolerance means failures are masked completely, at a much higher cost.

Why It Exists#

Everything fails eventually:

  • Disks fail at a rate of a few percent per year.
  • Servers crash, kernels panic, power supplies and network switches fail, and whole data centers lose power or cooling.
  • Software has bugs, and configuration pushes go wrong.
  • Operators make mistakes. A mistyped command during routine maintenance caused the large Amazon S3 outage in US-East-1 on 28 February 2017.

At scale, rare events become routine. A fleet of 10,000 servers, each failing once every three years, loses about nine servers a day.

So the goal is not to prevent every failure. It is to design so failures do not become outages, and to recover quickly when they do. Availability targets also drive cost and architecture: four nines needs automated recovery everywhere, while five nines usually needs multiple regions. Being precise about the target, and about the maths, stops teams from both under- and over-engineering. This page builds on Scaling Up vs Scaling Out.

How It Works#

Availability vs reliability vs durability#

PropertyQuestion it answersMeasured asExample failure
AvailabilityCan I use it right now?Successful requests / valid requests, or uptime %Site returns 503 errors for 20 minutes
ReliabilityDoes it work correctly, continuously, over time?Correct results, MTBF, failure rateSite is up but shows wrong balances, or crashes every few days
DurabilityIs my saved data still there?Probability of losing an object per yearA disk dies and the only copy is gone
ResilienceHow well does it absorb and recover from stress?Recovery time, degradation under loadA traffic spike causes a 2-hour outage instead of slower responses

They are independent:

  • A system can be available but unreliable: it answers quickly with wrong data.
  • It can be reliable but unavailable: it is correct but often down for maintenance.
  • It can be available and durable but not consistent: replicas temporarily disagree.

Durability usually needs the most nines. Amazon states that S3 is designed for 99.999999999% ("eleven nines") durability of objects over a year, while its availability targets are far lower. Losing data is much worse than briefly being unable to read it.

How to measure availability:

  • Time-based: the share of minutes in which the service was "up". This is simple, but it hides partial outages.
  • Request-based: the share of valid requests that succeeded within a latency threshold. This captures partial failures and slowness: a request that takes 30 seconds is not really "available". Most modern SLOs use this.
  • Where you measure matters. Server-side metrics miss requests that never arrived, for example during DNS or load balancer failures. Combine server metrics with load balancer logs and synthetic probes from outside your network.
  • Planned maintenance counts as downtime for users, even if contracts exclude it.

Nines and downtime budgets#

AvailabilityPer yearPer 30-day monthPer weekPer day
99%~3.65 days~7.2 hours~1.7 hours~14.4 minutes
99.5%~1.8 days~3.6 hours~50 minutes~7.2 minutes
99.9%~8.8 hours~43.8 minutes~10.1 minutes~1.4 minutes
99.95%~4.4 hours~21.9 minutes~5 minutes~43 seconds
99.99%~52.6 minutes~4.4 minutes~1 minute~8.6 seconds
99.999%~5.3 minutes~26 seconds~6 seconds~0.9 seconds

The downtime budget (or error budget) is the allowed unavailability. Google's SRE practice, described in "Site Reliability Engineering" (O'Reilly, 2016), uses it explicitly:

  • While budget remains, teams ship features and take risks.
  • When it is spent, they slow releases and focus on reliability.

This turns "how reliable should we be?" from an argument into a number both product and engineering agree on.

What each tier typically demands:

TargetTypical requirements
99%One server with backups; manual recovery is acceptable
99.9%Redundant instances, multi-zone, automated health checks; humans may handle rare failovers
99.95%-99.99%Everything redundant across zones, automated failover in seconds to a minute or two, safe deploys with automatic rollback, tested runbooks
99.999%Usually multi-region active-active, no human in any common recovery path, extremely careful change management, and dependencies that are themselves better than five nines

A useful sanity check: if a failover takes 2 minutes, a 99.99% service can afford only about two of them a month, with nothing else going wrong.

Availability in series vs parallel#

In series, a request needs every component to work. Multiply the availabilities:

A_total = A₁ × A₂ × ... × Aₙ

Two components at 99.9% in series give 0.999 × 0.999 ≈ 99.8%. Every hop you add makes things worse. A typical chain of load balancer (99.99%), app server (99.9%), cache (99.9%) and database (99.95%) gives:

0.9999 × 0.999 × 0.999 × 0.9995 ≈ 0.9974, or 99.74%, about 23 hours of downtime a year.

In parallel, redundant copies fail only if all of them fail. Multiply the failure probabilities:

A_total = 1 − (1 − A₁) × (1 − A₂) × ... × (1 − Aₙ)

Two copies at 99.9% in parallel give 1 − 0.001 × 0.001 = 99.9999%.

Worked example. Make the series chain redundant:

  • Two load balancers at 99.99%: 1 − (0.0001)² ≈ 99.999999%.
  • Three app servers at 99.9%: 1 − (0.001)³ ≈ 99.9999999%.
  • Cache as a soft dependency: on a cache failure, reads fall back to the database (which must be sized for it). The cache then leaves the critical chain entirely.
  • Database primary plus hot standby at 99.95% each: 1 − (0.0005)² ≈ 99.99998%.

The product is about 99.9999% on paper. In reality you will see perhaps 99.95-99.99%, because the simple formulas assume three things that are not true:

  1. Independent failures. Real failures are correlated. Both app servers run the same buggy release; both database nodes sit in a zone that loses power; all instances share one DNS provider. One correlated failure mode can dominate the total.
  2. Instant failover. Moving traffic takes time: detection (seconds to tens of seconds), promotion, and clients reconnecting. During that window the service is down.
  3. Perfect failover logic. Failover code is rarely exercised and often has bugs of its own, and split-brain or a flapping health check can cause outages.

k-of-n systems. Quorum-based systems need k of n replicas up. With 3 replicas at 99.9% each and a majority (2) needed:

A = p³ + 3p²(1 − p) ≈ 0.997003 + 0.002994 ≈ 99.9997%.

That is much better than one node, though slightly worse than "any 1 of 3".

Hard vs soft dependencies. A hard dependency makes the request fail when it fails. A soft dependency only degrades the response: recommendations missing, a default avatar, a cached price. Turning hard dependencies into soft ones removes them from the series product, and is often the single most effective availability improvement.

MTBF and MTTR#

  • MTBF (mean time between failures): how long, on average, the system runs between failures.
  • MTTR (mean time to recovery or repair): how long, on average, it takes to restore service. It includes MTTD (mean time to detect), the time to diagnose, and the time to mitigate.
  • MTTF (mean time to failure) is used for non-repairable parts such as disks. Disk vendors also quote an annualised failure rate (AFR), often 0.5-2% per year for modern drives in fleet data.

Availability = MTBF / (MTBF + MTTR).

Worked comparison for a service that fails about once a month (MTBF ≈ 720 hours):

ChangeMTBFMTTRAvailability
Baseline720 h60 min720 / 721 ≈ 99.86%
Double MTBF (fewer failures)1,440 h60 min≈ 99.93%
Cut MTTR to 6 minutes (automation)720 h6 min720 / 720.1 ≈ 99.986%

Cutting repair time by 10x gained far more than halving the failure rate. That is why mature teams invest in:

  • fast detection, through alerts on user-facing SLOs and synthetic probes;
  • automated mitigation, through failover, automatic rollback and traffic shifting;
  • quick diagnosis, through tracing, dashboards and runbooks.

They do not rely only on preventing failures. "Mitigate first, then find the root cause" is the standard incident practice: roll back the deploy or drain the zone, then investigate.

Redundancy#

Redundancy means having more than one of anything that can fail, so a spare can take over. Common sizing terms:

  • N: exactly the capacity needed, with no spare. Any failure hurts.
  • N+1: one spare unit. Survives one failure.
  • N+2: survives a failure during maintenance or a second failure.
  • 2N: a full duplicate, such as a second data center.

Failure domains are the scopes that fail together: process, host, rack (shared switch and power), availability zone (a data center with independent power and networking), region, and cloud provider. Redundancy only helps if the copies are in different failure domains. Three replicas on one rack are one failure domain.

Capacity headroom per zone. Running across three zones means that losing one zone leaves two to carry all traffic. Each zone must therefore run at no more than about 67% of its capacity in normal operation, or you must be able to scale up the survivors fast, which may be impossible during a regional event when everyone else is scaling too. AWS calls designs that keep working without making new changes during a failure static stability. For example, it pre-provisions enough capacity in each zone instead of relying on launching instances during an outage.

Redundancy only works with detection and switching. A spare that nobody notices is needed, or that traffic cannot reach, adds nothing. Every redundant design needs health checks, a mechanism to move traffic, and regular tests.

Failover: active-passive vs active-active#

Active-passive (also called primary-standby, or historically master-slave):

  1. The active node serves all traffic; the passive node waits.
  2. Heartbeats run between them.
  3. If heartbeats stop, the passive node takes over. It claims the active node's virtual IP, gets DNS updated, or is promoted by an orchestrator.

The standby temperature decides downtime:

  • Hot standby: running and continuously replicated. Failover takes seconds to a couple of minutes.
  • Warm standby: running but needs catch-up or warming. Minutes.
  • Cold standby: must be started and restored from backups. Tens of minutes to hours.

Managed databases such as Amazon RDS Multi-AZ automate hot-standby failover, typically within one to two minutes.

Active-active (also called multi-primary, or historically master-master):

  • All nodes serve traffic, and the load is spread between them.
  • If one fails, the others absorb its share. There is no promotion step, so recovery is near-instant once health checks remove the failed node.
  • For public-facing services, DNS or anycast must know all the endpoints. For internal services, clients or service discovery must know them all.
  • Stateless tiers are naturally active-active.
  • For stateful data, active-active means accepting writes in several places, which needs conflict handling (last-writer-wins, CRDTs, or partitioning so each key has one home). See Multi-Region Data.
Active-passiveActive-active
Capacity useStandby idle (or serving only reads)All nodes serve
Failover timeDetection + promotion: seconds to minutesNear-instant; health checks remove the bad node
Data conflictsNone; one writerPossible for writes, unless partitioned per key
Data loss on failoverPossible with async replication (recent writes)Possible for unreplicated writes in the failed site
Headroom neededStandby must match primarySurvivors need spare capacity (each at ≤ 1 − 1/N)
FitsDatabases, single-writer systemsStateless tiers, read-heavy global systems, partitioned data

Both models add hardware and complexity. Two numbers describe what a failover costs:

  • RPO (recovery point objective): how much recent data you may lose. Asynchronous replication means a non-zero RPO, the writes that had not reached the standby. Synchronous replication gives an RPO of zero at the cost of write latency.
  • RTO (recovery time objective): how long recovery may take.

Split-brain and fencing. The most dangerous failover bug is two nodes both believing they are primary. The usual cause is a network partition: the standby cannot reach the primary and promotes itself, while the primary is still serving clients. Both accept writes, and the data diverges. Defences:

  • Quorum: only promote with a majority vote of an odd number of witnesses (three or five), so at most one side of a partition can act.
  • Fencing: before promoting, cut the old primary off. Revoke its storage access, power it off (STONITH: "shoot the other node in the head"), or use fencing tokens, monotonically increasing numbers that storage checks so stale leaders' writes are rejected.
  • Leases: a primary may serve only while it holds a time-limited lease from a consensus system (etcd, ZooKeeper, Consul). It must stop when the lease expires.

Tools such as Patroni (PostgreSQL) combine these with a consensus store.

How real systems stay available#

The same ideas appear in every major datastore:

  • Replicated logs (Kafka). Each partition has a leader and followers on different brokers, usually with a replication factor of 3. With acks=all and min.insync.replicas=2, a write is acknowledged only when the in-sync replicas have it, so losing one broker loses no acknowledged data, and a follower is promoted to leader. In practice, the more common failure is a consumer dying, not the brokers:
    • Consumers commit their offset after processing. A restarted consumer resumes from the last commit and may reprocess a few messages (at-least-once delivery).
    • The consumer group rebalances the dead consumer's partitions onto the survivors.
    • Commit only after the work is safely stored, and keep each consumer's unit of work small so a crash redoes little.
  • Quorum replication (DynamoDB). AWS describes each DynamoDB partition as three replicas across three availability zones, kept consistent with a Multi-Paxos-based leader.
    • A write is acknowledged once two of the three replicas have persisted it to their logs.
    • Strongly consistent reads go to the leader; eventually consistent reads can use any replica.
    • Global Tables add replicas in other regions.
  • Leaderless replication (Cassandra). Nodes gossip and use a phi accrual failure detector to judge, each independently, whether a peer is down. It outputs a suspicion level from heartbeat history instead of a fixed yes or no. Writes for a down replica are stored by the coordinator as hints and replayed when it returns (hinted handoff). Longer outages are repaired by read repair and anti-entropy repair. Suspected nodes stay in the ring rather than triggering data movement, so brief restarts do not cause expensive rebalancing.
  • Replicated caches (Redis). Each shard has replicas. Redis Sentinel or Redis Cluster detects a failed primary and promotes a replica automatically, usually within seconds. Replication is asynchronous, so the last few writes can be lost, which is acceptable for most cache data.

See Replication, Quorums and Leaderless Replication and Delivery Semantics.

Fault tolerance vs high availability#

High availability (HA)Fault tolerance (FT)
GoalRecover quickly; brief interruption allowedNo interruption; failure is invisible
MechanismRedundancy + detection + failoverFull redundancy with synchronous state, voting or instant switch-over
ExampleDatabase failover in 30-60 sRAID mirror losing a disk; quorum writes surviving one replica; lockstep CPUs in aircraft
CostModerateHigh (duplicate everything, synchronous coordination)
Typical useMost web servicesStorage layers, payments core, safety-critical systems

Most systems mix the two: fault-tolerant storage (quorum-replicated, so one replica's loss is invisible) under highly available services (stateless instances replaced in seconds).

Graceful degradation is the practical middle ground. When a part fails, serve a reduced but useful experience instead of an error:

  • a cached or stale page;
  • read-only mode;
  • the core flow without recommendations;
  • a queue that accepts orders and processes them later.

Fail open or fail closed?#

When a supporting component fails (a rate limiter, an auth cache, a feature-flag service, a fraud check), the caller must choose:

  • Fail open: proceed as if the check passed. This keeps the product available but removes protection. It can be dangerous when the supporting component failed because of overload: failing open then sends the entire flood to the backend and can collapse the platform.
  • Fail closed: reject requests (HTTP 503 or 429) when the check cannot run. This is safe for security and money, but it turns the supporting component's outage into a full outage, and clients that retry aggressively make it worse.

There is no universal answer; choose per dependency from the requirements:

  • Payments, authorisation and security checks usually fail closed.
  • Recommendations, analytics and personalisation fail open or degrade.
  • Rate limiters are debated. A platform that expects failures during viral spikes may fail closed to protect its databases. Another may fail open with a local, per-instance fallback limit, which is a good compromise.

Either way:

  • make the primary component highly available, for example a replicated Redis with automatic failover;
  • alert loudly whenever a fail-open or fail-closed mode activates;
  • test the mode.

Health checks done right#

Every failover mechanism depends on a health signal, and bad health checks cause outages of their own.

  • Liveness asks "is the process stuck or dead?". If it fails, restart the process. Keep it shallow: an endpoint that returns OK if the event loop or thread pool responds. Never include dependencies, or a database blip will restart your whole fleet at once.
  • Readiness asks "should this instance receive traffic right now?". If it fails, stop routing to the instance but do not kill it. Include what the instance itself needs: warm-up finished, local caches loaded, its connection pool healthy.
  • Shallow vs deep checks. A deep check that calls the shared database makes every instance fail together when the database is slow. The load balancer then removes all instances, turning a degraded service into a total outage. Many load balancers "fail open" when every target is unhealthy for exactly this reason. Check shared dependencies separately, and alert on them rather than ejecting instances.
  • Thresholds and hysteresis. Require several consecutive failures before removing an instance and several successes before adding it back, so flapping instances do not oscillate in and out.
  • Outside-in checks. Synthetic probes from other regions and networks catch DNS, certificate, CDN and routing problems that internal checks never see.

Removing SPOFs#

SPOFFix
Single app serverMultiple stateless instances behind a load balancer, across zones
Single load balancerManaged multi-zone LB, or an active-passive pair with a floating IP (keepalived/VRRP)
Single databaseStandby replica with automated, fenced failover; backups tested by restoring
Single cache nodeReplicas with automatic failover; cache as a soft dependency
Single availability zoneSpread instances and replicas over 2-3 zones with headroom
Single regionMulti-region with health-checked DNS or anycast failover (for the highest tiers)
Single DNS or CDN providerSecondary provider for critical domains
Mandatory lookup service (shard directory, config, auth)Replicate it, cache its answers locally, make it a soft dependency
One message brokerReplicated cluster (replication factor 3, min in-sync replicas 2)
Manual deploys to all nodes at onceCanary and staged rollouts with automatic rollback
Certificates and secretsAutomated renewal (ACME), expiry alerts, replicated secret stores
One person who knows the systemRunbooks, on-call rotation, shared ownership

To find SPOFs, draw the request path and ask, for each box and each arrow: "If this disappears right now, what happens?" Then ask the same about control planes (deploy systems, DNS, identity), which are often forgotten until they fail.

Handling spikes without losing availability#

Many outages are caused not by hardware but by load: a launch, a viral post, a retry storm. Availability under spikes comes from:

  • Buffering: put a durable queue or log (Kafka, SQS) between ingestion and processing, so bursts wait instead of failing. Monitoring and logging pipelines rely on this.
  • Autoscaling with headroom, and pre-scaling for known events.
  • Load shedding: reject or defer low-priority work first (analytics, prefetches) to protect critical paths.
  • Rate limiting per client, so one client cannot consume shared capacity.
  • Bounded retries with exponential backoff and jitter, and retry budgets, so failures do not multiply load.
  • Circuit breakers that stop calling a failing dependency and let it recover.

See Resilience Patterns and Rate Limiting.

Worked example: an availability budget for checkout#

The formulas above are only useful if you turn them into a budget: a list of the things that will go wrong in a typical month, how long each one hurts, and whether the total fits the target. Here is a realistic budget for an e-commerce checkout with a target of 99.95% per 30-day month, which allows about 21.6 minutes of failed requests.

The request path is: CDN and DNS, a regional load balancer, a stateless checkout API across three zones, a PostgreSQL primary with a synchronous standby, a Redis cache, an inventory service, and an external payment provider.

Source of downtimeAssumptionExpected cost per month
Database failoverAbout one failover a quarter (crash, patching, hardware). Detection, promotion and reconnection take about 40 s0.33 × 0.67 min ≈ 0.2 min
Bad deploys with canariesTwo bad releases a month. Each reaches 5% of traffic for 5 minutes before automatic rollback2 × 5 min × 5% ≈ 0.5 min
Bad deploys without canariesSame two releases rolled out to everyone; 15 minutes to notice and roll back2 × 15 min ≈ 30 min (budget blown)
Zone failureAbout one per year; 3 minutes until health checks drain the zone and the survivors absorb load3 min ÷ 12 ≈ 0.25 min
Instance crashesSeveral a day, but the load balancer stops sending traffic within about 30 s and retries cover in-flight requests≈ 0.1 min
Payment provider as a hard dependencyProvider offers a 99.95% SLAUp to 21.6 min by itself
Payment provider as a soft dependencyA second provider for failover, or accept the order and authorise within minutes from a queue≈ 1-2 min

Three lessons fall out of this table:

  1. The deploy process matters more than the hardware. Canaries and automatic rollback turn the largest item into one of the smallest. That matches industry experience that changes cause most incidents.
  2. One external hard dependency can consume the whole budget. If a dependency's own SLA equals your target, your target is impossible unless you make that dependency soft, add a second provider, or move it off the synchronous path.
  3. Failover time is the price of each hardware event. The database is "99.99% available" on paper, but what actually costs minutes is how often it fails over and how long each failover takes.

The other thing a budget shows is the reserve. Summing the realistic lines gives roughly 3-4 minutes, leaving about 17 minutes for the unknown: a novel bug, a certificate that expires, an overload event. A budget with no reserve will be broken by the first surprise.

The dotted edge leads to the soft dependencies. They are not part of the series product, so their outages do not appear in the availability total; they appear only as a degraded experience.

Standby temperature and database failover in practice#

The difference between hot, warm and cold standby is easiest to see as a timeline. Each step either exists or does not, and each costs time.

Step during failoverHot standbyWarm standbyCold standby
Detect the failure10-30 s10-30 s10-30 s, or a human page
Start the replacementAlready runningAlready runningMinutes: boot, install, configure
Load the dataAlready replicatedReplay the replication backlog: seconds to minutesRestore a backup and replay logs: tens of minutes to hours
Warm caches and buffersMostly warm, if it served readsCold buffer pool: slow for minutesCold
Redirect clientsSeconds (VIP, DNS with low TTL, discovery)SecondsSeconds to minutes
Typical total30 s to 2 minA few minutes30 min to hours
Data loss (RPO)Zero with sync replication; seconds with asyncSeconds to minutesEverything since the last backup or archived log

Managed services publish their own numbers. AWS documents typical failover for RDS Multi-AZ instances at about one to two minutes, and for Aurora, which shares one storage volume across zones and only has to promote a reader, typically under about 30 seconds.

Self-managed PostgreSQL usually uses Patroni, which shows how a production failover is put together:

  • Each database node runs a Patroni agent. The primary holds a leader key in a consensus store (etcd, Consul or ZooKeeper) with a time-to-live. Patroni's defaults are a 30-second TTL, renewed every 10 seconds.
  • If the primary dies, it stops renewing, and the key expires.
  • The replicas race to take the key. Only a replica whose replication lag is below a threshold (maximum_lag_on_failover, 1 MB by default) is allowed to win, so a far-behind replica cannot become primary and silently drop data.
  • The winner promotes itself, and clients find it through the consensus store, a load balancer health check, or a DNS record.
  • An old primary that cannot reach the consensus store demotes itself instead of continuing to serve. That self-fencing is what prevents split-brain when the primary is cut off rather than dead.

With synchronous mode enabled, Patroni only promotes a replica that was synchronous, which gives an RPO of zero.

Two practical details decide whether this works when it matters:

  • Connection handling. Applications must reconnect and retry idempotent operations automatically. Pools that cache a dead connection for minutes, or DNS that a JVM caches forever, add more downtime than the database promotion itself.
  • Planned switchover. Use the same machinery for patching: switch over deliberately at a quiet hour. That proves the path works and keeps failover a routine operation, not a feared one.

Kafka: durability settings and consumer failure#

Kafka is the most common durable buffer in modern designs, so interviewers often ask "what happens if Kafka goes down?". A good answer starts by naming the settings that decide its behaviour.

On the producer and broker side:

  • acks=0: the producer does not wait at all. It is fastest, and messages can be lost silently.
  • acks=1: the leader writes the message to its log and acknowledges. If the leader dies before followers copy it, the message is lost.
  • acks=all: the leader waits until every replica in the in-sync replica set (ISR) has the message. Combined with min.insync.replicas=2 and a replication factor of 3, an acknowledged message is on at least two brokers, so losing any one broker loses nothing.
  • A follower drops out of the ISR if it falls too far behind; recent versions use a 30-second lag time by default (replica.lag.time.max.ms).
  • If the ISR shrinks below min.insync.replicas, producers using acks=all get errors instead of acknowledgements. The partition chooses consistency over availability for writes, which is the right default for orders and payments.
  • unclean.leader.election.enable=false, the default, means an out-of-sync replica may never become leader. Setting it to true restores availability sooner after a bad failure but can drop acknowledged messages.
  • Idempotent producers, the default since Kafka 3.0, attach sequence numbers so a retried send after a timeout does not create duplicates in the log.

When a leader broker fails, the controller elects a new leader from the ISR, usually within seconds, and producers and consumers refresh their metadata and continue. A well-configured cluster is therefore one of the most available components in the design. In an interview it is reasonable to say "Kafka with RF 3 and min ISR 2 survives a broker or zone loss; I am more worried about the consumers".

On the consumer side, failure is routine:

  • A consumer reads a batch, processes it, and commits the offset: the position it has finished.
  • If it crashes, the group coordinator notices missed heartbeats (a session timeout, 45 seconds by default in recent versions) or a stalled poll loop (max.poll.interval.ms, 5 minutes by default). It then rebalances, giving the partitions to the surviving consumers.
  • The new owner resumes from the last committed offset. Anything processed but not committed is processed again. This is at-least-once delivery, so the processing must be idempotent.

When to commit is the real design decision. Commit too early, before the work is durable, and a crash loses the message. Commit too late, after a large amount of work, and a crash repeats all of it. Auto-commit, which commits every 5 seconds by default regardless of processing state, can do either.

The web crawler is a good example:

  • A crawler worker takes a URL from the topic, fetches the page, stores the HTML in object storage, then commits the offset. If it crashes before the store succeeds, the URL is fetched again; nothing is lost.
  • Fetching and parsing are split into two stages with a queue between them. The fetch stage downloads and stores raw HTML. A separate parse stage extracts text and links and enqueues new URLs. A crash in parsing therefore never repeats a slow network fetch, and each stage scales and fails independently.
  • A URL that keeps failing is retried with exponential backoff and, after a few attempts, sent to a dead-letter queue instead of blocking the partition forever.

See Apache Kafka in Practice, Message Queues and Design a Web Crawler.

Failure detection: from timeouts to phi accrual#

Every failover starts with one node deciding that another is dead. In an asynchronous network this is fundamentally a guess: a node that does not answer may be crashed, overloaded, paused for garbage collection, or simply on the far side of a slow link. The detector's job is to make that guess well.

Fixed timeouts are the simplest: "if no heartbeat for 10 seconds, declare it dead". The choice is a direct trade-off:

  • A short timeout detects real failures quickly, which lowers MTTR, but it also convicts healthy nodes during a GC pause or a burst of packet loss. Each false conviction can trigger a failover that causes its own outage.
  • A long timeout is stable but adds its full length to every real outage.

A common rule of thumb is a timeout of several heartbeat intervals plus the worst normal pause: with 1-second heartbeats and occasional 2-second GC pauses, something like 5-10 seconds.

The phi accrual failure detector (Hayashibara, Défago, Yared and Katayama, 2004) replaces the yes-or-no answer with a continuous level of suspicion:

  • Each node records the arrival times of heartbeats from a peer and keeps a sliding window of recent intervals.
  • When the next heartbeat is late, it asks: "given the intervals I have seen, how unlikely is it to have waited this long?"
  • It reports phi = −log10(probability that a heartbeat would arrive later than now). A phi of 1 means about a 10% chance the node is actually fine; a phi of 8 means about one chance in 100 million.

A worked example with normally distributed intervals: the mean interval is 1.0 s with a standard deviation of 0.1 s. After 1.5 s of silence the delay is 5 standard deviations past the mean, so the chance of a heartbeat still arriving is about 3 × 10⁻⁷, and phi ≈ 6.5. On a jittery link with a standard deviation of 0.5 s, the same 1.5-second silence is only one standard deviation late, phi is about 0.8, and nobody panics. The detector adapts to the network it is on.

Cassandra uses this approach on top of gossip, with a default conviction threshold of 8. Its implementation simplifies the maths by assuming exponentially distributed intervals, so phi grows linearly with silence: phi ≈ elapsed time ÷ (mean interval × 2.3). With a 1-second mean, a threshold of 8 is reached after about 18 seconds of silence.

Two design choices around the detector matter as much as the detector:

  • Each node decides for itself. In Cassandra, every node keeps its own view of which peers are up and stops routing requests to the ones it convicts. There is no central judge to become a bottleneck or a single point of failure.
  • Conviction is not removal. A convicted node stays in the ring and keeps owning its token ranges. Data is only moved when an operator decommissions or replaces the node. A node that reboots for a kernel patch therefore causes no expensive data streaming, and a false conviction costs very little.

While a replica is down, writes it should have received are handled by hinted handoff: the coordinator stores a hint ("this write belongs to node C") and replays it when C returns. Hints are kept only for a limited window, three hours by default (max_hint_window). For longer outages, the node is brought back in sync by read repair, which fixes stale replicas noticed during reads, and by anti-entropy repair, which compares Merkle trees of the data between replicas and streams only the differing ranges.

Gray failures complicate all of this. A node that answers heartbeats but fails 5% of real requests looks healthy to every heartbeat-based detector. That is why load balancers and service meshes add outlier detection based on real traffic: Envoy, for example, can eject an endpoint after a run of consecutive 5xx responses or when its success rate is far below its peers'. See Heartbeats, Failure Detection and Gossip.

Limiting the blast radius: cells, shuffle sharding and zonal isolation#

Redundancy protects against independent failures. It does nothing against the failures that dominate real downtime: a bad deploy, a poison request that crashes every server that touches it, or one huge customer overloading shared capacity. Those hit every copy at once. The defence is to make sure no single failure can reach all users. This is called limiting the blast radius.

Cell-based architecture splits the system into many complete, independent copies called cells. Each cell has its own load balancers, application servers, databases and queues, and serves a fixed subset of customers.

  • A thin cell router maps each customer (by tenant ID or user ID) to its cell. The router is kept as simple as possible, because it is the one shared component.
  • Cells do not call each other on the request path.
  • Deploys roll out one cell at a time, so a bad release first hurts one cell, not everyone.
  • Each cell has a maximum size, so capacity limits and failure modes are discovered at a known scale and never at "the whole company".

If a system has 20 cells and one fails, 5% of customers are affected. They suffer a full outage, but the incident is 20 times smaller than with one shared stack. AWS has published guidance on this pattern ("Reducing the Scope of Impact with Cell-Based Architecture"), and Slack described in 2023 how it moved to a cellular design in which a sick availability zone can be drained quickly.

Shuffle sharding goes further when you have many customers and a shared pool of workers. Instead of assigning each customer to one cell, assign each customer a random small combination of workers.

  • With 8 workers and each customer given 2, there are 28 possible pairs. If one customer sends a poison request that crashes both of its workers, only customers who share exactly that pair lose all capacity, about 1 in 28. Customers sharing one worker still have their other one.
  • With 100 workers and shards of 5, there are about 75 million combinations, so the chance that two customers share a whole shard is negligible.

Amazon described using shuffle sharding for Route 53, where each customer's domains are served by a different combination of name servers, so an attack on one domain does not take out others.

Zonal isolation applies the same idea to availability zones. Each zone's services call only dependencies in the same zone wherever possible, so a sick zone stays contained and can be drained as a unit. It also avoids cross-zone latency and transfer charges.

Cells have costs: duplicated infrastructure, cross-cell features such as global search or admin reports that need separate systems, and migrations when a customer outgrows a cell. They pay off for large multi-tenant SaaS and infrastructure services, where one bad day for everyone is unacceptable.

Overload: load shedding, retry amplification and brownouts#

Many of the worst outages are not caused by anything breaking. They are caused by more work arriving than the system can do. A server pushed past its capacity does not simply serve fewer requests; it often serves none, because every request waits in a queue, times out, and wastes the work done on it. The aim is to keep goodput, the rate of useful completed requests, high even when offered load is far above capacity.

Load shedding rejects excess work early and cheaply:

  • Measure how busy you are: concurrent requests in flight, queue length, or how long requests have waited in the queue.
  • Above a limit, reject new requests immediately with HTTP 503 or 429 and a Retry-After header. A rejection costs microseconds; a request that times out after 10 seconds costs a thread, memory and a database connection for all of that time.
  • Shed by priority. Drop prefetches, analytics events and background syncs first; keep checkout and login. Requests can carry a priority header set at the edge.
  • Drop requests that have already waited too long. If the client's timeout is 2 seconds and a request has sat in the queue for 2.5, finishing it is wasted work. Facebook's "Fail at Scale" (Ben Maurer, ACM Queue, 2015) describes queues that switch to adaptive LIFO under overload, so the newest requests, whose clients are still waiting, are served first, plus a controlled-delay limit on queueing time.

Retry amplification is how overload spreads. Suppose a request passes through three layers and each layer retries a failed call up to 3 times. When the bottom layer is slow, the top makes 3 attempts, each middle call makes 3, each lower call makes 3: up to 27 times the normal load on the struggling component, exactly when it can least handle it. Defences:

  • Retry at one layer only, usually the one closest to the user, or the one that knows whether the operation is idempotent.
  • Use exponential backoff with jitter, so retries spread out instead of arriving in synchronised waves.
  • Use a retry budget: allow retries only while they are a small fraction (for example 10%) of total requests. During a real outage retries stop automatically instead of multiplying load.
  • Honour Retry-After and circuit breakers, which fail fast while a dependency is known to be down.

Brownouts degrade instead of rejecting. Under pressure the service turns off expensive optional features: personalised ranking falls back to a cached popular list, images are served at lower resolution, search returns fewer results. Users get a slightly worse experience and the core keeps working. Feature flags are the usual mechanism, ideally triggered automatically from load metrics.

See Resilience Patterns for circuit breakers, bulkheads and back pressure in detail.

Error budgets in practice: burn-rate alerting#

An SLO only helps if the team knows quickly when it is in danger. Alerting on "the error rate is above 0.1%" is either too noisy (one bad minute pages someone at night) or too slow (a steady 0.2% error rate spends the whole monthly budget in two weeks without ever crossing a spike threshold).

The burn rate fixes this. It is how fast you are spending the error budget, relative to the rate that would use exactly all of it by the end of the window:

burn rate = observed error rate ÷ (1 − SLO)

For a 99.9% SLO the allowed error rate is 0.1%. An error rate of 1.44% is a burn rate of 14.4: at that pace the 30-day budget lasts about two days.

The Google SRE Workbook (2018) recommends alerting on several windows at once:

SeverityBurn rateLong windowShort windowBudget spent when it fires
Page14.41 hour5 minutes2%
Page66 hours30 minutes5%
Ticket13 days6 hours10%

The long window makes the alert significant; the short window, which must also be burning, makes the alert stop soon after the problem is fixed. A fast, severe incident pages within minutes, while a slow leak opens a ticket instead of waking anyone.

The error budget policy says what happens when the budget is spent, agreed in advance by product and engineering:

  • freeze risky launches and spend the next sprint on reliability work;
  • require a post-incident review for any incident that used more than a set share, for example 20%, of the budget;
  • if the service is consistently far inside its budget, the SLO may be stricter than users need, so take more risk or lower costs.

See Observability for SLIs, SLOs and alerting on symptoms.

When to Use It#

  • When setting non-functional requirements: pick an availability target per user-facing flow, not one number for everything. Checkout may need 99.99%, while a reporting page may be fine at 99.5%.
  • When drawing the high-level design: check every component on the critical path for redundancy and failover.
  • When choosing replication and failover settings for databases, caches and brokers.
  • When deciding fail-open vs fail-closed behaviour for supporting services.
  • When planning capacity per zone or region, so the survivors can carry the load.
  • In incident reviews: measure MTTD and MTTR and look for the slowest step.

When NOT to Use It#

  • Do not chase five nines for internal tools, batch jobs or early products; each extra nine costs far more than the last.
  • Do not add redundancy without health checks and tested failover; untested redundancy creates false confidence and new failure modes.
  • Do not count on multiplying nines from vendor SLAs as a prediction; correlated failures and your own changes dominate.
  • Do not make every dependency fault-tolerant; make most of them soft dependencies instead.

How to Implement It#

  1. Set SLOs per critical user journey (success rate and latency), with an error budget and an owner.
  2. Map dependencies on each journey and classify each as hard or soft; turn hard into soft where possible.
  3. Compute the target: series and parallel maths with realistic failover times; find the weakest link.
  4. Add redundancy across failure domains: at least two instances per tier across two or three zones, and replicated stateful systems with fenced automatic failover.
  5. Detect fast: health checks (separate liveness, "is the process alive?", from readiness, "can it serve traffic?"), SLO burn-rate alerts and external synthetic probes.
  6. Mitigate fast: automated rollback, traffic draining per zone, feature flags to disable broken features, and runbooks for the rest.
  7. Limit blast radius: staged deploys, cells or shards per customer group, and quotas.
  8. Test it: failover drills, game days and chaos experiments, and backup restores on a schedule.
  9. Review incidents without blame, and track MTTD and MTTR trends.
# Illustrative: load balancer health checks + Kubernetes probes and disruption budget
targetGroup:
  healthCheck:
    path: /healthz/ready        # readiness: dependencies needed to serve
    intervalSeconds: 10
    healthyThreshold: 2
    unhealthyThreshold: 3       # ~30 s to remove a bad instance
---
livenessProbe:  { httpGet: { path: /healthz/live,  port: 8080 }, periodSeconds: 10, failureThreshold: 3 }
readinessProbe: { httpGet: { path: /healthz/ready, port: 8080 }, periodSeconds: 5,  failureThreshold: 2 }
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: { name: api }
spec:
  minAvailable: 75%            # voluntary disruptions (drains, upgrades) keep capacity
  selector: { matchLabels: { app: api } }
TechnologyFits when
AWS ALB/NLB, Google Cloud Load Balancing, Azure Load BalancerManaged, multi-zone load balancing with health checks
Amazon RDS / Aurora Multi-AZ, Cloud SQL HA, Azure SQL zone-redundantManaged database failover within a region
Patroni + etcd (PostgreSQL), MySQL Group Replication / InnoDB ClusterSelf-managed, fenced database failover
Redis Sentinel / Redis Cluster, ElastiCache Multi-AZCache failover
Kafka (RF 3, min.insync.replicas=2), managed KafkaDurable, highly available event logs
Route 53 / Cloud DNS health-checked records, global anycast LBsRegion-level failover
Kubernetes (ReplicaSets, topology spread, PodDisruptionBudgets)Keeping N instances running across zones
Chaos Monkey, AWS Fault Injection Service, Gremlin, LitmusChaosTesting failure handling deliberately

Trade-offs#

ChoiceGainCostPick when
Active-passiveSimple, no write conflictsIdle capacity, failover delay, possible data loss with async replicationDatabases, most stateful systems
Active-activeNo idle capacity, fast recoveryConflict handling for writes, headroom needed in survivorsStateless tiers, global read-heavy systems, partitioned data
Multi-AZSurvives a data center loss~1-2 ms between zones, cross-zone transfer costsAlmost every production system
Multi-regionSurvives a region loss, low global latency2x+ cost, cross-region consistency, complexityTop-tier SLOs, global users, regulation
Synchronous replicationRPO = 0Higher write latency; availability depends on replica healthPayments, ledgers, metadata
Asynchronous replicationLow write latencyRecent writes lost on failoverMost web data, caches
Fail openAvailabilityLost protection; overload riskNon-critical checks
Fail closedSafetyOutage spreads from the dependencyMoney, security, compliance
Fault toleranceInvisible failuresHigh cost and coordination latencyStorage layers, safety-critical paths
Cell-based architectureSmall blast radius for deploys, poison requests and overloadDuplicated infrastructure, a cell router, cross-cell features need extra systemsLarge multi-tenant services
Shuffle shardingOne customer's failure rarely affects others completelyMore complex placement and routingShared worker pools with many tenants
Aggressive failure detectionLower MTTRFalse failovers during GC pauses and blipsStateless tiers where a false eviction is cheap
Conservative failure detectionStable, few false alarmsLonger outages before failoverDatabases, leaders, anything where failover is expensive
Static stability (pre-provisioned headroom)Survives a zone loss without the control planeAbout 50% more capacity in three zonesCritical services, regional events
Load shedding and brownoutsGoodput stays high under overloadSome users are rejected or get a reduced experienceAny service that can receive spikes
Kafka acks=all with min ISR 2No acknowledged message lost on a broker failureHigher produce latency; writes rejected if the ISR shrinksOrders, payments, events that must not be lost

Common Pitfalls#

  • Multiplying vendor nines and believing the result, ignoring correlated failures (same release, same zone, same DNS).
  • Redundant copies in one failure domain, such as replicas on the same rack or all instances in one zone.
  • Failover that has never been tested, or that needs a human with credentials at 3 a.m.
  • Split-brain from promoting a standby without quorum or fencing.
  • No capacity headroom: losing one zone of three overloads the remaining two.
  • Health checks that test only "process up", sending traffic to instances that cannot reach their database; or deep health checks that mark every instance unhealthy when a shared dependency blips.
  • Treating backups as durability without ever restoring one.
  • Retrying aggressively during an outage and turning a partial failure into a total one.
  • Measuring availability only on servers, missing DNS, network and client-side failures.
  • Retries at every layer, so a slow database receives 27 times its normal load during an incident.
  • A recovery path that depends on the control plane, such as launching instances or reading config from a service that is itself down.
  • Committing Kafka offsets before the work is durable, or enabling unclean leader election on topics that must not lose data.
  • A dependency whose own SLA equals your target, left as a hard dependency.
  • A cache that the database cannot survive losing, with no plan for warming or rate-limiting the fallback.

Real-World Examples#

On 28 February 2017, an incorrectly entered command during debugging removed more Amazon S3 servers in US-East-1 than intended. Restarting the affected subsystems took hours, and many websites and services that depended on S3 in that region were disrupted. AWS's public summary led to changes such as removing capacity more slowly and adding safety checks. It is a classic example of human error, correlated dependency on one region, and long recovery time.

Netflix introduced Chaos Monkey around 2011 to terminate production instances randomly, forcing services to tolerate instance loss. It later expanded the idea to larger failures, such as evacuating a whole AWS region.

Google's "Site Reliability Engineering" book (2016) popularised SLOs and error budgets as the mechanism for balancing reliability against feature velocity.

On 4 October 2021, Facebook, Instagram and WhatsApp were unreachable for about six hours. Facebook's engineering write-up explains that a command issued during routine backbone maintenance unintentionally disconnected its data centers. Its DNS servers, unable to reach the data centers, withdrew their BGP route announcements, so the domains vanished from the internet. Recovery was slowed because the internal tools and remote access that engineers normally use depended on the same network, an example of a recovery path that shared a failure domain with the thing it had to recover.

In November 2020, an Amazon Kinesis outage in US-East-1 began when capacity added to the front-end fleet pushed servers past an operating-system thread limit. Services built on Kinesis, including some of AWS's own, were affected, showing how a dependency can be hidden inside another service.

Amazon has described using shuffle sharding in Route 53, so that an attack or overload aimed at one customer's domains reaches only the small combination of name servers assigned to them.

AWS describes DynamoDB partitions as three-way replicated across availability zones with a Paxos-based leader and majority-acknowledged writes. A single replica or zone failure is invisible to clients: storage-level fault tolerance under a highly available service.

In the Interview#

Walking through failure scenarios in an interview#

When the interviewer asks "what happens if this fails?", answer the same five questions for each component, in order:

  1. How is the failure detected, and how fast? Health checks, heartbeats, a consensus lease, client errors.
  2. What happens to requests in flight? Do they fail, get retried, or wait in a queue?
  3. Is any data lost? That is the RPO: zero with synchronous replication or acks=all, seconds of writes with async replication.
  4. How does service recover, and how long does it take? That is the RTO: failover, rebalancing, restart.
  5. Can the survivors carry the load? Headroom, autoscaling, load shedding.

Applied to a chat application with WebSocket gateways, Kafka, Cassandra and a Redis presence cache:

Component failsDetectionIn-flight workData lossRecovery
One WebSocket gatewayLB health check, about 10-30 s; clients see the socket close at onceClients reconnect with backoff and jitter to another gateway and fetch missed messages since their last-seen IDNone: messages are in Kafka and CassandraSeconds; survivors need headroom for a reconnect wave
One Kafka brokerController notices within secondsProducers retry and partition leaders moveNone with RF 3, acks=all, min ISR 2Seconds
A delivery consumerGroup session timeoutPartitions rebalance; uncommitted messages redeliveredNone; duplicates removed by message ID on the clientTens of seconds
One Cassandra nodePhi accrual on each peerCoordinators route around it; writes at QUORUM still succeedNone; hints replay on returnHints within 3 hours, otherwise repair
Redis presence cacheCluster failover within secondsPresence shows "unknown" briefly (soft dependency)Recent presence updates, rebuilt from heartbeatsSeconds
Whole zoneAll of the above at onceTraffic drains to the other two zonesNone for committed dataMinutes; capacity planned at about 67% per zone

Naming the detection time, the data-loss window and the capacity plan for each row is what separates a strong answer from "we have replicas".

Deep Dive: Availability math beyond the textbook formulasShow

Failover time is downtime. Consider a primary that fails about once a quarter, with detection of 30 seconds, promotion of 20 seconds and client reconnection of 40 seconds. That is about 90 seconds per incident, or 6 minutes a year, roughly 99.999% from this cause alone. But a 99.99% monthly budget (4.4 minutes) is exhausted by three such failovers in one bad month. When estimating, multiply the expected number of failovers by their duration, then add the other causes.

Correlated failures dominate. Suppose each app instance fails independently at 0.1% of the time, and a bad deploy that takes down all instances happens once a quarter for 20 minutes. The independent part contributes almost nothing with 3+ instances; the deploy contributes about 80 minutes a year. Nearly all real downtime comes from common-mode causes:

  • deploys and configuration changes, which industry incident reports consistently rank among the top causes;
  • shared dependencies;
  • capacity exhaustion;
  • regional events.

So the most valuable availability investments are often progressive delivery (canaries, staged rollouts, automatic rollback), cells that cap the blast radius, and removing shared dependencies, not more replicas.

Partial availability. With sharding or cells, an incident usually affects some users, not all. Request-based availability captures this. If 1 of 20 cells is down for an hour, overall availability for that month drops by only 1/20 of an hour's worth (about 3 minutes), although those users had a full hour-long outage. Report both fleet-wide numbers and the worst-affected customers.

Gray failure. Huang and colleagues ("Gray Failure: The Achilles' Heel of Cloud-Scale Systems", HotOS 2017) describe failures that one observer sees and another does not. A node passes its health checks but drops 5% of requests, or a disk is slow but not failed. Simple heartbeats miss these. Detection needs observations from the clients' point of view, such as error rates and latency per instance from the callers, plus outlier detection that ejects instances performing much worse than their peers.

Failure detection is a trade-off. Aggressive timeouts detect failures fast (lower MTTR) but cause false positives and unnecessary failovers, especially during GC pauses or network blips. Conservative timeouts are stable but slow. Adaptive detectors, such as the phi accrual detector introduced by Naohiro Hayashibara and colleagues in 2004 and used by Cassandra and Akka, compute a suspicion level from the observed heartbeat distribution. Each consumer of that signal can choose its own threshold.

Deep Dive: Durability math and why repair speed mattersShow

Durability is about the probability of losing every copy of some data before any lost copy is replaced.

Take 3 replicas on independent disks with a 2% annualised failure rate, and suppose a failed replica is rebuilt within 1 hour.

  • The chance that a given disk fails in a specific hour is 0.02 / 8,760 ≈ 2.3 × 10⁻⁶.
  • When one replica fails, data is lost only if both remaining replicas fail before the rebuild finishes: about (2.3 × 10⁻⁶)² ≈ 5 × 10⁻¹².
  • With about 3 × 0.02 = 0.06 first failures per year for that replica set, the annual loss probability is about 3 × 10⁻¹³ under independence.

The levers this reveals:

  • Repair time appears squared. Rebuilding in 6 minutes instead of an hour improves durability about 100x for 3-way replication. That is why large storage systems spread each disk's data across many disks (declustered placement): a failed disk is rebuilt in parallel by hundreds of peers in minutes, instead of by one replacement disk over hours.
  • Independence is the real assumption. Disks from one batch, one rack's power, one firmware bug or one operator command break it. Spread replicas across racks and zones, and keep backups and point-in-time recovery on a separate system and account. Replication faithfully copies a mistaken DELETE everywhere.
  • Erasure coding stores data as k data fragments plus m parity fragments, for example 10 + 4. Any 10 of the 14 are enough to rebuild the data, so it survives 4 losses at 1.4x storage overhead instead of 3x. The price is CPU, and more network traffic on reads and rebuilds. Object stores use it widely for durable, cheaper storage.
  • Silent corruption (bit rot, bad firmware) needs checksums on every block and background scrubbing, so a bad copy is found and repaired while good copies still exist.

Durability claims of "eleven nines" are design targets derived from this kind of model plus operational practice. They describe protection against hardware loss, not against your own application deleting data. That is a reliability and backup problem.

See Storage Fundamentals and Object Storage.

Deep Dive: Disaster recovery tiers and zero-downtime maintenanceShow

Zones protect against a data center failure. Disaster recovery (DR) plans for losing a whole region, a cloud account, or the data itself, for example through corruption, ransomware or an accidental mass delete. AWS's disaster recovery guidance names four common strategies, ordered by cost and recovery speed:

StrategyWhat runs in the second regionTypical RTOTypical RPORelative cost
Backup and restoreNothing; backups are copied thereHours to a dayHours (since the last backup)Lowest
Pilot lightData replicated continuously; core infrastructure defined but scaled to near zeroTens of minutes to hoursSeconds to minutesLow
Warm standbyA scaled-down but working copy of the full stackMinutesSeconds to minutesMedium
Multi-site active-activeFull production in two or more regions serving trafficSeconds to minutes (often automatic)Near zero to secondsHighest (2x or more)

How to choose:

  • Start from the business cost of downtime and data loss per hour, then pick the cheapest tier that meets the RTO and RPO.
  • Most companies run active-active within a region (across zones) and warm standby or pilot light across regions.
  • Only the most critical global services pay for multi-region active-active.

Practices that decide whether DR actually works:

  • Rehearse it. Run regular region-evacuation exercises. An untested DR plan typically fails on credentials, DNS TTLs, capacity limits in the target region, hard-coded endpoints, or data that was not replicated after all.
  • Keep backups logically separate. Use a different account, immutable or object-locked storage, and separate credentials. Replication copies a mistaken delete or an attacker's encryption instantly; only isolated, versioned backups protect against it.
  • Use point-in-time recovery (PITR) for databases, through continuous log archiving, so you can restore to just before a bad write rather than to last night.
  • Watch DNS TTLs and client caching. Failover that relies on DNS takes at least the TTL, often longer because some clients ignore it. Anycast or global load balancers avoid this.
  • Mind capacity in the target region. During a real regional event, many customers fail over at once. Pre-reserved capacity (static stability) is safer than launching on demand.

Zero-downtime maintenance removes the "planned downtime" that otherwise eats the budget:

  • Rolling deploys: replace instances a few at a time behind the load balancer, with connection draining.
  • Blue-green deploys: run the new version alongside the old one and switch traffic at once, with instant rollback by switching back.
  • Canary releases: send 1-5% of traffic to the new version, compare error rates and latency automatically, then proceed or roll back.
  • Expand-and-contract schema migrations: add new columns or tables first, deploy code that writes both, backfill, switch reads, then remove the old schema. No step locks or breaks the running version. See Data Migration.
  • Database maintenance through replicas: patch the standby, fail over deliberately at a quiet time, then patch the old primary.
Deep Dive: Markov models, k-of-n maths and common-cause failuresShow

The series and parallel formulas treat each component as "up with probability p". A slightly richer model shows where the numbers come from and when they break.

Each component as a two-state machine. A component fails at rate λ (1 / MTTF) and is repaired at rate μ (1 / MTTR). In steady state it is down a fraction λ / (λ + μ) of the time, which is the same as MTTR / (MTTF + MTTR). With an MTTF of 1,000 hours and an MTTR of 2 hours, a single node is down about 0.2% of the time: 99.8% available.

Two redundant nodes, independent repair. If each node fails and is repaired independently, both are down a fraction (λ / (λ + μ))² of the time: (2 / 1,002)² ≈ 4 × 10⁻⁶, or 99.9996%. The pair is down about once every 250,000 hours, and for about one hour each time, because the overlap of two repair windows is short.

This model also shows two things the simple formula hides:

  • Repair time enters twice. Halving MTTR roughly quarters the pair's unavailability, because both the chance of a second failure during a repair and the length of the overlap shrink.
  • Shared repair capacity matters. If one on-call engineer must repair both nodes one after the other, the overlap lasts longer and the pair is worse than the formula says.

k-of-n systems. For n replicas, each up with probability p, and a system that needs k of them:

A = sum over i from k to n of C(n, i) × pⁱ × (1 − p)ⁿ⁻ⁱ

The leading failure term is roughly C(n, n − k + 1) × (1 − p)ⁿ⁻ᵏ⁺¹: the number of ways to lose one more replica than you can tolerate. For p = 0.999:

ConfigurationToleratesUnavailability (approx.)Availability
1 of 10 failures10⁻³99.9%
2 of 3 (majority quorum)1 failure3 × 10⁻⁶99.9997%
3 of 5 (majority quorum)2 failures10 × 10⁻⁹ = 10⁻⁸99.999999%
1 of 3 (any replica)2 failures10⁻⁹99.9999999%

Common-cause failures. Reliability engineers model correlation with a beta factor: a fraction β of each component's failures hit all redundant copies at once (same release, same power feed, same bad config). Take β = 5% for the two-node pair above:

  • The common-cause failure rate is 0.05 × (1 / 1,000 h) = 5 × 10⁻⁵ per hour.
  • Each one takes the pair down for about one MTTR (2 hours), so the common-cause unavailability is about 10⁻⁴.
  • The pair is now about 99.99% available, not 99.9996%. The 5% of correlated failures cause 25 times more downtime than all the independent ones.

That is the mathematical reason why diversity matters: replicas in different zones, deploys rolled out at different times, a second DNS provider, different hardware batches. Each one reduces β, and β, not the number of replicas, usually sets the ceiling on availability.

Deep Dive: Metastable failures and why some outages do not end by themselvesShow

Most failures stop once the trigger is removed: the bad deploy is rolled back and the errors stop. A metastable failure is different. A trigger pushes the system into a bad state, and a sustaining effect keeps it there after the trigger is gone. The term comes from Nathan Bronson, Abutalib Aghayev, Aleksey Charapko and Timothy Zhu, "Metastable Failures in Distributed Systems" (HotOS 2021), and a follow-up study by Lexiang Huang and colleagues ("Metastable Failures in the Wild", OSDI 2022) found the pattern behind many public incidents at large cloud providers.

The classic sustaining effects:

  • Retry storms. A short slowdown causes timeouts, clients retry, and the retries add load, which causes more timeouts. The system can stay saturated by retries alone long after the original slowdown has ended.
  • Cache loss. A cache that absorbs 95% of reads is flushed or restarted. The database suddenly receives 20 times its normal load, slows down, and the cache cannot be refilled because every fill is a slow database read. The system was stable with a warm cache and is stable, at zero goodput, with a cold one.
  • Timed-out work. Servers keep processing requests whose clients have already given up, so all capacity goes to work nobody will use.
  • Failover cascades. A node fails, its load moves to its neighbours, they overload and fail, and their load moves on.

The states can be drawn as three regions:

Running in the vulnerable state is normal and efficient: high utilisation, no problems. The danger is that a small trigger, such as a brief network blip, a deploy or a cache restart, has no way back on its own.

How to design against it:

  • Remove or weaken the sustaining loop. Use retry budgets and circuit breakers so retries cannot multiply load. Drop work whose deadline has passed. Propagate deadlines between services so downstream work stops when the caller has given up.
  • Plan cache recovery. Warm caches before sending traffic, refill gradually, use request coalescing so that a thousand misses for one key cause one database read, and rate-limit the database fallback path.
  • Keep headroom where the sustaining effect is strong, especially in front of caches and on databases.
  • Have a big red button. Recovery usually needs an explicit load reduction: shed a share of traffic at the edge, turn off retries, or block a client class, then restore gradually. Make these controls exist and practise them before you need them.
Deep Dive: Static stability, control planes and data planesShow

Large systems are split into two kinds of component:

  • The data plane does the actual work for each request: load balancers forwarding packets, servers answering requests, storage nodes serving reads.
  • The control plane changes the data plane: launching instances, updating routing tables, provisioning databases, pushing configuration.

Data planes are simple and very highly available. Control planes are more complex, change more often, and are typically less available. A key design rule, emphasised in Amazon's published guidance, is that during a failure, recovery should not depend on the control plane. Systems that obey it are called statically stable: they keep working through a failure without making any changes.

Two ways to survive losing one of three zones show the difference:

ApproachDuring normal operationWhen a zone fails
ReactiveRun at about 90% utilisation in three zonesAsk the control plane to launch about 50% more instances in the remaining zones, at the same moment as every other customer in the region
Statically stableRun at about 67% utilisation, enough that two zones can carry the whole loadHealth checks remove the failed zone. Nothing new needs to be launched

The statically stable approach costs roughly 50% more capacity. It removes the dependency on the control plane at the worst possible moment.

The same rule applies elsewhere:

  • Cache configuration and credentials locally. If the configuration service or the identity service is down, a server should keep running with the last good config and still-valid credentials, not refuse to start.
  • Prefer pushing state to the data plane (for example, a route table that each load balancer holds in memory) over having the data plane query the control plane on every request.
  • Make DNS failover records point at already-running capacity.
  • Watch for circular dependencies. If your deploy system depends on the service you are trying to fix, or your incident chat and badge readers depend on the network that just went down, recovery slows dramatically.

Several well-known outages show the cost of breaking these rules. In the S3 incident of 2017, the subsystems that had to be restarted took hours to come back at their scale. In November 2020, adding capacity to the front-end fleet of Amazon Kinesis in US-East-1 pushed servers past an operating-system thread limit, and other AWS services that depended on Kinesis were affected too. In both cases the lesson was about how dependencies and recovery paths were built, not about a lack of replicas.

Key Takeaways#

  • Availability is "can I use it now", reliability is "does it work correctly over time", durability is "is my data still there"; measure availability per request from the user's point of view.
  • Each nine cuts allowed downtime by 10x: 99.9% is about 43.8 minutes a month, 99.99% about 4.4 minutes.
  • Series components multiply availabilities; parallel redundancy multiplies failure probabilities; correlated failures and failover time break both formulas.
  • Availability = MTBF / (MTBF + MTTR); faster detection and automated mitigation usually buy more nines than fewer failures.
  • Put redundancy in independent failure domains with headroom, and detect and switch automatically.
  • Active-passive is simple with one writer; active-active uses all capacity but needs conflict handling for writes; guard failover with quorum and fencing.
  • High availability tolerates brief interruptions; fault tolerance masks failures entirely at higher cost.
  • Decide fail-open vs fail-closed per dependency, turn hard dependencies into soft ones, and remove hidden SPOFs.
  • Build an availability budget: expected failovers times their duration, deploy impact, dependencies and a reserve. Canaries and soft dependencies usually matter more than hardware.
  • Correlated (common-cause) failures, not the number of replicas, set the ceiling. Limit the blast radius with staged rollouts, cells and shuffle sharding.
  • Protect goodput under overload: shed load early by priority, retry at one layer with budgets, and design against metastable states such as retry storms and cold caches.
  • Alert on error-budget burn rate over several windows, and keep recovery independent of control planes (static stability).