Fault Tolerance, High Availability, and Disaster Recovery Questions
Keeping a system serving despite failure, from code-level resilience to infrastructure-level recovery: circuit breakers, retries with backoff and jitter, timeouts, bulkheads, graceful degradation, and preventing cascading failures, alongside redundancy, failover (active-active versus active-passive), RPO and RTO objectives, backup and restore, and multi-region failover. Covers dependency-failure isolation, chaos engineering to validate resilience, failure-mode analysis, designing to nines of availability, cost-versus-availability tradeoffs, and recovery runbooks. Spans both the patterns that isolate partial failure and the disaster-recovery planning that restores a business-critical system after a major outage.
Define cascading failure and walk through a realistic example: service C fails, B (which depends on C) gets overloaded, and A (which depends on B) starts degrading too. At each layer, what protection would you put in place to stop the cascade from propagating?
Sample Answer
Direct answer
A cascading failure is when one component's failure increases load or latency on the components that depend on it, and that increased load causes those components to fail too, propagating outward until a large part of the system is affected, even though only one component actually broke in the first place. The mechanism is almost always resource exhaustion: threads, connections, or memory tied up waiting on the failed component instead of being freed quickly.
Walkthrough: C fails, B overloads, A degrades
flowchart LR
A[API Gateway] -->|rate limit and timeout| B[Order Service]
B -->|bulkhead pool: payments| C[Payment Service]
C -.fails.-> B
B -->|circuit breaker opens| D[Fallback: queue order for async retry]
A -->|circuit breaker opens| E[Fallback: 503 with Retry-After]
B -->|isolated pool: other deps unaffected| F[Inventory Service]
- C (Payment Service) fails, hanging instead of returning errors quickly, perhaps due to a downstream outage of its own.
- B (Order Service) calls C without a tight timeout. Each call to C now blocks for far longer than normal, tying up a thread or connection from B's pool for the duration.
- B's resource pool exhausts. As more requests arrive at B, more threads get stuck waiting on C, until B has no capacity left to serve any request, including ones that don't even touch C.
- A (API Gateway) calls B, and B is now slow or unresponsive for everything, so A's calls to B start timing out or queueing too, degrading A's own capacity in turn.
Worked example: how fast does B's pool actually exhaust?
Little's Law relates the number of requests in flight to the arrival rate and the time each spends being processed:
L=λWSay B receives 500 requests per second, and under normal conditions each call to C takes 50ms:
Lnormal=500×0.05=25 concurrent in-flight requests25 concurrent requests is a light load on a typical connection pool. Now C hangs, and B's HTTP client has no explicit timeout of its own, falling back to a default of 30 seconds:
Lfailure=500×30=15,000 concurrent in-flight requests neededIf B's thread pool has 200 threads, the time to exhaust it entirely is:
texhaust=500200=0.4 sUnder 400 milliseconds. That's how quickly a single hung dependency with no timeout turns into total unavailability for a service handling 500 requests per second: the pool never gets close to steady-state at the 30-second hang time, it simply fills with stuck requests almost instantly and stays full.
Protections at each layer
- At B, calling C: a tight, explicit timeout (measured in low hundreds of milliseconds, not the client library's 30-second default) so a hung call fails fast and frees the thread quickly; a circuit breaker that opens after a run of failures or timeouts, so B stops even attempting calls to C once it's clearly down, and falls back to queueing the order for later processing; a bulkhead, a dedicated connection pool just for calls to C, so exhaustion from C-related calls doesn't consume the threads B needs to serve requests that don't touch C at all (like inventory checks).
- At A, calling B: the same pattern one layer up, a timeout on calls to B, a circuit breaker that trips once B's error rate or latency crosses a threshold, and a fallback (a fast 503 with
Retry-Afterrather than a hung request) so A's own capacity isn't consumed waiting on a B that's already struggling.
Trade-offs & pitfalls
Timeouts that are too aggressive cause false-positive failures under normal, brief latency variance; timeouts that are too loose don't prevent the cascade fast enough, as the Little's Law example shows. Bulkheads cost real resources (a dedicated pool per dependency uses more total connections or threads than one shared pool) in exchange for isolation, so they're worth applying to the dependencies most likely to fail or most likely to take down unrelated traffic if they do. The most common mistake is only protecting the first hop (B to C) and assuming that's sufficient; as the walkthrough shows, without protection at the A to B hop too, the failure still reaches A once B is degraded, just one layer later.
Explain active-active versus active-passive architecture. For each, walk through the typical failover behavior, what it takes to detect a failure, and when you'd choose one over the other.
Sample Answer
Active-active runs all nodes or regions serving live traffic at the same time, so failover is mostly a routing problem: stop sending traffic to the unhealthy node. Active-passive keeps one side idle (or partially warmed) as a standby, so failover is a promotion problem: detect the primary is down, make the standby the new primary, then redirect traffic to it. That difference in what has to happen during failover is what drives everything else: recovery speed (RTO, recovery time objective: how long it takes to restore service after a failure), data-consistency risk (RPO, recovery point objective: how much data, measured in time, you could lose in a failure), and cost.
Comparing the two
| Dimension | Active-active | Active-passive |
|---|---|---|
| What's serving traffic | All nodes/regions, concurrently | Only the primary; standby is idle or warm |
| Failure detection | Health checks per node feed a load balancer or GSLB (Global Server Load Balancer: a DNS-based load balancer that routes traffic across regions, not just across servers in one place), which simply stops routing to the failed one | Health checks must trigger an explicit promotion decision, usually with a consensus/quorum step to avoid promoting during a false alarm |
| What "failover" does | Reroute traffic; no state transition needed | Promote replica to primary, update routing (DNS or LB config), then reroute traffic |
| Typical RPO | Near-zero if writes are synchronously replicated or conflict-resolved; otherwise bounded by replication lag | Near-zero with a synchronous standby, up to minutes with an async one |
| Consistency risk | Needs conflict resolution or partitioned ownership if writes happen on both sides (dual-writer problem) | Simpler: single writer at any point in time, no conflict resolution needed |
| Cost/complexity | Higher: full capacity running everywhere, plus distributed-write tooling | Lower: standby can run at reduced capacity (or be provisioned only at failover time) |
| Best fit | Latency-sensitive, globally distributed traffic; teams that can invest in multi-writer data patterns | Systems needing a single source of truth for writes (most transactional relational databases); cost-sensitive setups |
Worked example: deriving RTO for each
Pin the same detection policy to both: a health check runs every 5 seconds, and 3 consecutive failures are required before the system acts (15 seconds to declare a node down; this avoids reacting to a single dropped probe).
Active-active RTO: once the node is declared down, the load balancer or GSLB removes it from rotation immediately (no promotion step). If we assume that rotation update takes about 5 seconds to propagate to all edge/LB nodes:
RTOactive-active≈15s (detect)+5s (reroute)=20 secondsActive-passive RTO: the same 15 seconds to detect, plus a promotion step (electing the standby, replaying any un-applied log entries, opening it for writes, say 20 seconds for a warm standby with low replication lag) plus DNS or routing propagation (assume a low TTL of 30 seconds, and worst case the full TTL has to expire before every client picks up the change):
RTOactive-passive≈15s (detect)+20s (promote)+30s (routing propagation)=65 secondsUnder these pinned assumptions, active-active recovers about 3x faster, entirely because it skips the promotion step, and that gap only grows if the standby is cold rather than warm (add provisioning time) or if the routing layer is DNS with a high TTL instead of a fast health-checked LB.
Trade-offs and pitfalls
Active-active's speed advantage is real but not free: the moment two regions can both accept writes to the same record, you have a distributed-write problem, and skipping it (assuming replication will "just" reconcile) is the most common wrong turn. It needs either a conflict-resolution strategy (last-write-wins with vector clocks, CRDTs) or partitioned ownership (each region owns a disjoint key range) to avoid silently losing or corrupting data during a partition. Active-passive's failure mode is different: over-eager health checks or a flapping network link can trigger a premature promotion while the old primary is still technically reachable by some clients, producing two nodes that both believe they're primary (split-brain), which is why production active-passive systems add fencing (forcibly cutting off the old primary's access to shared storage) on top of the detection logic above, not just a timer. The same trade-off shows up outside a classic web/DB stack too: failing over an ML-serving fleet is closer to active-active in spirit (multiple replicas of the same model serving concurrently, so losing one just drops capacity) unless the model itself is being hot-swapped, in which case the promotion-style risk (serving from a half-loaded or stale model version) reappears.
Using the CAP theorem, walk through the trade-off you'd make for a financial ledger service versus an analytics event aggregator. Which guarantee does each give up during a network partition, and why?
Sample Answer
CAP theorem says that during a network partition, a distributed system must choose between consistency (every read sees the latest acknowledged write) and availability (every request gets a response), because it can't guarantee both while the partitioned halves can't talk to each other. Partition tolerance itself isn't optional for any system that spans more than one node, so the real choice interview questions are testing is CP versus AP, and the right answer depends entirely on what happens if you get it wrong.
Financial ledger: choose CP
A ledger getting a stale or divergent balance is a correctness bug with real financial consequences (double-spend, incorrect balance shown, a transaction accepted twice), so consistency has to win. The concrete mechanism is a consensus protocol requiring a write quorum.
Deriving what "sacrifice availability" actually means, with a pinned example: take a 5-node replica set (a typical Raft cluster size) where a majority quorum is required to commit a write:
quorum=⌊2N⌋+1=⌊25⌋+1=3That cluster tolerates up to N−quorum=2 node failures while still committing writes. Now suppose a network partition splits the 5 nodes into a 3-node side and a 2-node side. The 3-node side still has a majority (3 ≥ quorum of 3), so it keeps accepting writes and stays both consistent and available. The 2-node side does not have a majority (2 < 3), so by design it must refuse writes, becoming unavailable, specifically to prevent both sides from independently committing conflicting transactions. That refusal on the minority side, not a global shutdown, is the literal, computable meaning of "CP sacrifices availability during a partition": only the minority partition goes unavailable, and only for writes.
Analytics event aggregator: choose AP
An analytics pipeline getting an event a few seconds late, or briefly double-counted before deduplication catches up, is a rounding error on a dashboard, not a financial loss, so availability wins: every node keeps ingesting even when it can't see the others.
The mechanism looks different from the ledger: instead of a write quorum gatekeeping every write, use leaderless or partitioned ingestion (each partition or node accepts writes for its own shard independently, as in Kafka-style partitioned logs or a Dynamo-style leaderless store), so there's no majority to lose and no write path that can be blocked by a partition. The cost shifts from "unavailable during a partition" to "eventually reconciled after one": deduplication on ingest, idempotent consumers, and background reconciliation jobs to merge whatever diverged while the partition was open.
Comparing the two designs
| Dimension | Ledger (CP) | Analytics aggregator (AP) |
|---|---|---|
| Write path | Quorum-gated (majority must ack) | Leaderless / partitioned, no quorum gate |
| During a partition | Minority side refuses writes | Both sides keep accepting writes independently |
| Consistency mechanism | Consensus (Raft/Paxos-style) | Eventual consistency + reconciliation |
| Failure mode if you pick the wrong side | Double-spend, incorrect balances | Stale dashboard, temporary undercounts |
| Client-side pattern needed | Idempotency keys so a client retry after a rejected write is safe | Deduplication keys so late/duplicate events don't double-count on reconciliation |
Trade-offs and pitfalls
The common misreading of CAP is treating CP as "the whole system goes down during any partition," when the quorum math above shows it's specifically the minority side, and only for writes, reads can often still be served (possibly stale, depending on the read-consistency level chosen). The common mistake on the AP side is stopping at "it's eventually consistent" without actually building the reconciliation path: leaderless ingestion without idempotent consumers and deduplication just relocates the correctness problem downstream instead of solving it. And even a CP ledger still needs idempotency keys on the client side: a client that times out waiting for a quorum ack and retries the same transaction must not have it applied twice, which is a consistency concern CAP itself doesn't cover but that any real ledger design has to handle regardless of which side of CAP it lands on.
Not every service in your portfolio needs the same level of redundancy. Walk through how you'd tier services (say critical, important, noncritical) and what redundancy level and SLO target you'd assign to each tier, and why.
Sample Answer
Direct answer: Not every service deserves the same redundancy budget, because redundancy costs money and operational complexity that only pays off if the service's failure actually hurts the business. I'd tier services by blast radius (does it touch revenue, does it touch customer trust, is there a regulatory SLA) rather than by how technically interesting the service is, and assign each tier a concrete SLO (service level objective: the target reliability number the team commits to hitting, e.g. 99.9% uptime), redundancy model, and error budget derived from that SLO, not an arbitrary one.
Structured elaboration: a three-tier model
| Tier | Example services | SLO target | Redundancy model | Monthly error budget |
|---|---|---|---|---|
| Critical | Checkout, auth, payment processing | 99.99% | Active-active across 2+ regions, automated failover | (1−0.9999)×730×60=4.38 min |
| Important | Search, recommendations, internal APIs other teams depend on | 99.9% | Active-passive cross-region or multi-AZ single region, automated failover | (1−0.999)×730×60=43.8 min |
| Noncritical | Internal admin tools, batch analytics, nightly reports | 99.0% | Single-region, autoscaled, manual recovery acceptable | (1−0.99)×730×60=438 min (≈ 7h 18m) |
The error budget column isn't asserted, it's derived from the SLO the same way allowed downtime is derived from an availability target: budgetmonth=(1−A)×730×60 minutes. Notice the tiers are roughly 10x apart from each other in budget (4.38 to 43.8 to 438 minutes), which mirrors the 10x-per-nine relationship and makes the tiers easy to reason about and communicate.
How I'd assign a service to a tier:
- Revenue/legal impact: does an outage stop money from moving, or breach a contractual SLA? If yes, floor is Critical regardless of traffic volume.
- Blast radius to other teams: is this a shared dependency other services call synchronously? A "low traffic" internal auth service can still deserve Critical tier because everything downstream inherits its outage.
- User-facing vs. internal: internal tools default one tier lower than an equivalent customer-facing service, unless (2) applies.
- Recoverability: if a noncritical batch job fails, does it self-heal on the next run with no lasting damage? If yes, it can sit at 99% even if "important" sounding, because the cost of a missed run is low.
Worked example applying the model: a checkout service (Critical, 99.99%, active-active) calls a recommendations service (Important, 99.9%) for a "customers also bought" widget. If recommendations goes down, checkout's tier assignment only holds if checkout is built to degrade gracefully when that dependency fails (skip the widget, keep processing the order), rather than blocking checkout on it. This is the practical reason tiering isn't just about the service itself, it forces you to also classify every dependency edge as "must be up for me to meet my SLO" or "nice to have," which is often the more useful output of the exercise than the tier label itself.
Trade-offs & pitfalls
- Over-tiering (calling too many services Critical) defeats the purpose: if everything is active-active multi-region, you've spent the budget without actually differentiating risk, and you've made the org slower to ship everywhere instead of faster where it doesn't matter.
- Tiers need a review cadence. A service that started as an internal tool and quietly became load-bearing for a customer-facing flow needs to be re-tiered; without a periodic review, tier assignments rot and stop reflecting actual blast radius.
- Political pressure to over-tier is common (every team believes their service is critical); the fix is grounding tier assignment in the revenue/legal/blast-radius questions above with a named approver, not a self-declared label.
- A common wrong turn: tiering the service but not its dependencies. A Critical-tier service that synchronously calls a Noncritical-tier dependency on its hot path has effectively downgraded itself to the dependency's tier, no matter what its own SLO document says.
Multiple instances of a service are reporting health independently, and some of them are flapping between healthy and unhealthy every few seconds. Design the aggregation layer that turns per-instance signals into one stable service-level health decision without reacting to every blip.
Sample Answer
Direct answer
Stabilize in two stages: first debounce each instance's raw signal over time (require several consecutive consistent samples before trusting a state change), then aggregate the debounced per-instance states into one service-level decision using a quorum or percentage threshold, not "any single unhealthy instance flips the whole service." Stacking a temporal filter and a spatial one multiplies down the false-positive rate far more than either alone.
Two-stage design
stateDiagram-v2
[*] --> Healthy
Healthy --> Suspect: 1 bad sample
Suspect --> Healthy: 1 good sample
Suspect --> Unhealthy: k consecutive bad samples
Unhealthy --> Recovering: 1 good sample
Recovering --> Healthy: k consecutive good samples
Recovering --> Unhealthy: 1 bad sample
Per instance, debouncing with a threshold of k consecutive bad samples before committing to "unhealthy" (this is the state machine above) reduces the chance a single blip changes the reported state to:
Pspurious flip=pkwhere p is the per-sample probability that a healthy instance reports a bad sample due to transient noise (a slow GC pause, a dropped probe packet). Recovering asymmetrically (fewer good samples needed to go back healthy than bad samples needed to go unhealthy, or the reverse, tuned by SLA) keeps the machine from oscillating.
Service-level aggregation then requires m of N debounced instance states to agree before changing the reported service health, using the binomial tail:
P(at least m of N spuriously unhealthy)=j=m∑N(jN)pj(1−p)N−jWorked example
Suppose monitoring shows each sample has a 10% chance of spuriously flagging bad (p=0.1, pinned for this example):
p=0.1, k=1:p=0.1, k=2:p=0.1, k=3:p1=0.1p2=0.01p3=0.001Debouncing with k=2 already drops the per-instance spurious-flip rate from 10% to 1%. Now aggregate across N=10 instances using that debounced 1% rate:
N=10, p=0.01, m=1:N=10, p=0.01, m=6:P≈9.56×10−2P≈2.03×10−10With no quorum (any one debounced instance flips the service, m=1), the service-level false-positive rate is still nearly 10% per decision window, because with ten independent instances the chance that at least one of them blips is much higher than any single instance's own rate. Requiring a majority (m=6 of 10) collapses that to about 2 in 10 billion. That's the concrete case for why per-instance signals should never directly drive service-level decisions: debounce alone isn't enough once you have more than a handful of instances, you need the quorum too.
Trade-offs and pitfalls
Setting the quorum too high (near N) trades false-positive suppression for real-outage blindness: if 90% of instances genuinely go down, requiring unanimous agreement before declaring the service unhealthy delays a true incident response. Size m against the actual failure semantics you care about (a realistic simultaneous-failure scenario, like an AZ outage taking out a third of instances) rather than only against noise suppression. Also keep the debounce window and heartbeat interval in proportion: a long debounce window with a slow heartbeat interval adds real seconds to genuine-outage detection time, so the same knobs that suppress flapping also directly set your worst-case MTTD (mean time to detect: how long a genuine outage takes before it's recognized as unhealthy), and that trade-off needs to be explicit, not accidental.
Unlock Full Question Bank
Get access to all Fault Tolerance, High Availability, and Disaster Recovery interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.