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.
Your write region goes down for a couple of hours but your read regions are healthy. Design a graceful degradation plan: what stays available in read-only mode, what fails outright, and how do you communicate the degraded state to users?
Sample Answer
Direct answer
Keep serving reads from the healthy read regions immediately and unconditionally, since they don't depend on the write region at all; reject writes that require strong consistency or exactly-once guarantees outright with a clear error rather than pretending to accept them; and for writes that tolerate eventual consistency, queue them locally and durably so nothing is lost, then replay the queue once the write region recovers. The one rule that should never be violated is silently accepting a write and losing it: every write path is either "accepted and durably queued for later replay" or "rejected immediately," never "accepted and quietly dropped."
Architecture
Writes accepted by the anchor leader flow out to every read region as a CDC stream (change data capture: a continuous feed of every row-level change, read off the leader's own write log and replayed onto each replica), which is what keeps the read replicas caught up during normal operation, shown as the CDC node in the diagram below.
flowchart TD
CLIENT[Clients worldwide] --> RA[Region A read replica]
CLIENT --> RB[Region B read replica]
CLIENT --> RC[Region C read replica]
RA --> FWD[Write forwarder]
RB --> FWD
RC --> FWD
FWD --> LEADER[Anchor write leader, sharded by key range]
LEADER --> CDC[CDC stream]
CDC --> RA
CDC --> RB
CDC --> RC
When the write region (the anchor leader) goes down, the forwarder can no longer reach it. That's the trigger for the degradation workflow below; everything downstream of "detect the write region is unreachable" is about what each request type does next.
What stays available, what fails, what queues
| Request type | Behavior during the outage | Why |
|---|---|---|
| Reads (any kind) | Served normally from the nearest healthy read replica | Reads never depended on the write region; replication lag from before the outage started is the only staleness, and it stops growing once the write region is down (no new writes are landing to replicate) |
| Critical writes (billing, auth changes, anything needing exactly-once) | Rejected immediately with a 503 and a Retry-After header, structured as {mode: "read-only", eta: ..., writeAllowed: false} | These require strong consistency; queuing and replaying them risks double-charging or auth-state corruption, so refusing cleanly is safer than accepting and reconciling later |
| Non-critical writes (comments, drafts, "last viewed" timestamps) | Accepted at the edge, appended to a durable, region-local, idempotency-keyed queue, and the client gets a 202 Accepted with a queue ID | These tolerate eventual consistency, so queuing preserves the user's action without requiring the write region to be up right now |
| Complex cross-region features (distributed transactions, long multi-step jobs) | Disabled via feature flag for the duration of the outage | These need coordination that the write region's absence makes impossible to do correctly; a degraded system telling the user "this feature is temporarily unavailable" is better than a feature that silently does the wrong thing |
Communicating the degraded state
- API-level: every write endpoint that's disabled returns a structured error body, not a bare 503, so client applications can distinguish "the write region is down" from a generic server error and render an appropriate message instead of a raw failure.
- UX-level: a persistent banner ("Changes are temporarily disabled; you can still view everything. We'll apply queued updates once service resumes.") rather than silent failures scattered across individual actions, and per-action status for anything queued ("Saved locally, will publish when service resumes") so users aren't left wondering whether their action actually did anything.
- Ops-level: a status page update and, for major customers, proactive notification with an ETA, since 2 hours of read-only mode is the kind of thing enterprise customers expect to hear about before they notice it themselves.
Reconciliation when the writer returns
Queued writes are replayed in the order they were queued, using the idempotency key each write was tagged with to detect and skip duplicates (a client that retried a queued write multiple times during the outage shouldn't apply multiple times on replay). Conflict handling depends on the data type: commutative operations (counters, like counts) merge deterministically with no ambiguity; simple last-write-wins fields use the write's original logical timestamp, not the replay time, so a user's genuinely earlier edit doesn't overwrite a genuinely later one just because it replayed second; and content edits with a real risk of conflicting concurrent changes (two people editing the same document) get surfaced to the user as a merge conflict rather than silently resolved, because a silent wrong resolution is worse than asking.
Trade-offs & pitfalls
The scope of what gets classified "critical" versus "queueable" is the actual design decision here, and it's easy to get wrong in both directions: classifying too much as critical means the read-only window feels far more restrictive than it needs to be, while classifying too much as queueable risks a replay-time conflict resolution mess for data where "eventually consistent" was never actually an acceptable property. A related pitfall is bounding the queue: an unbounded local write queue during a multi-hour outage can grow large enough that the replay itself becomes a second incident (a burst of stale updates hitting the recovered write region all at once), so the queue needs both a size cap (reject new non-critical writes past a threshold, same as critical ones) and a TTL, with the two-hour outage in this scenario sized against realistic write volume before committing to "queue everything non-critical" as the policy. The same read-only degradation shape applies whether the thing behind the write region is a recommendation service, an image-preview pipeline, a personalization engine, or an analytics dashboard. In every case the same triage question decides the design: does this write need to be right immediately, or can it be right eventually, and only the answer to that question, not the specific feature, determines whether it queues or rejects.
Walk through full, incremental, differential, and snapshot-based backups. For a large transactional database, which combination would you actually run, and what does each choice cost you in restore time versus storage?
Sample Answer
Direct answer: A full backup copies everything; an incremental backup copies only what changed since the last backup of any kind; a differential backup copies everything changed since the last full backup; and a snapshot captures a point-in-time, storage-level image (often copy-on-write) rather than a separate file copy. For a large transactional database, the common answer is a weekly full plus daily incrementals plus continuous transaction-log shipping, because that combination gives a low recovery point (minutes of data loss) without paying full-backup storage and I/O cost every day.
Structured elaboration
| Backup type | What it stores | Restore chain length | Storage growth pattern |
|---|---|---|---|
| Full | Everything, every time | 1 backup set | Largest per run; constant regardless of how much data changed |
| Incremental | Changes since the last backup (full or incremental) | Full + every incremental since it, in order | Smallest per run, but restore requires replaying the whole chain |
| Differential | Changes since the last full | Full + latest differential only | Grows every day until the next full, then resets |
| Snapshot | Point-in-time storage image (usually copy-on-write) | 1 snapshot (or a base + deltas depending on the storage engine) | Cheap to create, but retaining many snapshots long-term accumulates the same changed-block cost as incrementals |
Restore chain length is the right way to reason about recovery complexity without making an unverifiable wall-clock claim: full and snapshot restores involve one artifact; differential restores always involve exactly two (full + latest differential, regardless of how many days have passed); incremental restores involve as many artifacts as days since the last full, so a chain 6 days deep means 7 total pieces (1 full + 6 incrementals) must apply cleanly, and a single corrupted link breaks the whole chain.
Worked example: 5 TB transactional database, weekly full + daily incrementals
Pin the assumption explicitly since this has to be derived, not asserted: assume 2% of the database's data changes per day (an illustrative rate; the real number should come from measuring actual write volume, but 2%/day is a reasonable planning figure for a moderately active OLTP (online transaction processing: a system handling many small, frequent reads and writes, like order or payment records, as opposed to bulk analytics queries) system).
- Day 0: full backup = 5 TB.
- Each daily incremental ≈0.02×5 TB=100 GB (treating the changed-data fraction as roughly constant day to day, a simplification for this estimate).
- By day 6 (just before the next weekly full), total incremental storage accumulated is 6×100 GB=600 GB.
- Total storage footprint for that week's backup set: 5 TB+0.6 TB=5.6 TB, a 12% overhead over the full alone (5.6/5=1.12).
Compare to a differential-only strategy at the same 2%/day rate: day 6's differential (changes since the day-0 full) would also be roughly 600 GB if changes were non-overlapping, but in practice differentials tend to be larger than the sum of same-period incrementals, because a row updated on day 2 and again on day 5 shows up in every day's differential from day 2 onward but only once across the incrementals. So the "incremental is smaller in total storage, differential is smaller to restore" trade-off holds here as expected.
Recovery point: with only daily backups, the recovery point objective (RPO) is bounded by the backup interval: worst case, you lose up to 24 hours of data (a failure right before the next scheduled backup). Adding continuous transaction-log shipping on top of the daily incrementals tightens the RPO to roughly the log-shipping interval (commonly seconds to a few minutes), independent of the backup schedule, which is why "backups alone" and "backups plus log shipping" are different RPO conversations for a transactional system.
Trade-offs & pitfalls
- Incrementals minimize storage and per-run I/O but maximize restore complexity (more pieces that must all be intact and applied in order); a single corrupted incremental in the chain can break every restore point after it.
- Differentials trade some storage growth (they get bigger every day until the next full) for a simpler, faster-to-verify two-piece restore.
- Snapshots are excellent for fast recovery when the underlying storage supports them cheaply, but for a live transactional database they require application-consistent quiescing (flushing buffers, pausing writes, or using the database's own snapshot-consistency mechanism) or the snapshot can capture a torn, inconsistent state.
- A common wrong turn: treating "we take backups" as equivalent to "we can restore." The only real validation is a periodic restore drill that rebuilds the database from the backup chain end to end; storage-level backup success says nothing about whether the restore path actually works.
Walk through the common replication topologies, single-leader, multi-leader, and quorum-based, and how each affects consistency, latency, and availability.
Sample Answer
Direct answer: Single-leader replication routes all writes through one node and copies them out to followers, giving strong consistency on the leader but a failover gap if it dies. Multi-leader replication lets several nodes accept writes independently and merge them later, trading consistency for local write availability. Quorum-based replication has no fixed leader; reads and writes each require acknowledgment from a configurable subset of replicas, and the overlap between those subsets is what determines the consistency guarantee.
Structured elaboration
| Topology | Consistency | Write latency | Availability under partition |
|---|---|---|---|
| Single-leader | Strong on the leader; followers can lag (eventual, unless reads are forced to the leader) | Low (single write path, no coordination) | Writes unavailable if leader partitioned away until failover completes; reads can continue from followers |
| Multi-leader | Eventual; requires conflict resolution (last-write-wins, CRDTs, app-level merge) | Low locally at each leader | High: each site keeps accepting local writes during a partition, at the cost of divergence to reconcile later |
| Quorum-based | Tunable, from eventual to strong, depending on read/write quorum sizes | Higher (must wait for multiple acknowledgments, not just one) | Survives a minority of node failures without going unavailable; a true majority-losing partition halts progress |
The quorum math that determines consistency: for N replicas, a write quorum of W nodes and a read quorum of R nodes, the system guarantees a read overlaps with the most recent write whenever
W+R>NThis is a direct pigeonhole argument: if W and R are subsets of the same N-replica set and ∣W∣+∣R∣>N, they cannot be disjoint (two disjoint subsets can sum to at most N elements total), so they must share at least one replica, and that shared replica has both the latest write and is included in the read.
Worked example with N=3:
- W=2,R=2: W+R=4>3, so every read quorum is guaranteed to overlap every write quorum by at least one replica. This gives strong (read-your-writes) consistency, at the cost of needing acknowledgment from 2 of 3 replicas on both reads and writes.
- W=1,R=1: W+R=2≤3, no overlap is guaranteed. A write can land on replica A while a read is served entirely from replica B, missing it. This is fast (single-replica round trip) but only eventually consistent.
Trade-offs & pitfalls
- Single-leader is the simplest to reason about and the default choice unless you have a specific reason not to use it; its main weakness is the failover window (detecting the leader is gone and safely promoting a replacement), not steady-state operation.
- Multi-leader avoids that failover gap for writes but pushes complexity into conflict resolution; it's the right choice specifically when you need low-latency local writes at multiple sites and can tolerate (or algorithmically resolve) concurrent edits, not as a general-purpose upgrade over single-leader.
- Quorum systems let you dial the W/R trade-off per workload (e.g., W=1 for a write-heavy, tolerant-of-staleness workload; W=N for a read-heavy workload that wants every read to be a single, fast, guaranteed-fresh replica read), but that tunability is also a footgun: teams often ship with W+R≤N by default (e.g., both set to 1 for speed) without realizing they've silently given up the consistency guarantee they assumed they had.
- A common wrong turn: treating "quorum-based" as automatically stronger than single-leader. With W+R≤N it is weaker, not stronger, than a single-leader system with synchronous replication to at least one follower.
Design a retry strategy with exponential backoff and jitter for calls to a downstream dependency that's struggling. Walk through why jitter matters, and how you'd make sure your retries don't make the dependency's problem worse when it starts recovering.
Sample Answer
Plain exponential backoff (double the delay after each failed attempt) reduces load on a struggling dependency over time, but it has a hidden flaw: if many clients failed at roughly the same moment (which is exactly what happens when the dependency itself goes down), they all compute the same delay sequence and retry in lockstep, so the "backoff" just delays the same synchronized spike instead of spreading it out. Jitter fixes that by randomizing the delay so clients that failed together don't retry together.
Jitter strategies compared
| Strategy | Delay formula | Behavior |
|---|---|---|
| No jitter | delay=base×2attempt | Deterministic; every client that failed together retries together, recreating the spike at each step |
| Full jitter | delay=random(0, base×2attempt) | Maximum spread; delay can be anywhere from 0 up to the cap, so retries are smeared thinly across the whole window |
| Equal jitter | delay=2cap+random(0, 2cap) | Keeps a guaranteed minimum delay (never retries immediately) while still spreading the upper half randomly |
| Decorrelated jitter | delay=random(base, previous delay×3) | Grows the delay based on the client's own previous delay rather than a fixed exponential schedule, avoiding a hard cap while still spreading load |
Worked example: how much jitter actually reduces the spike
Pin a concrete scenario: 1000 clients failed at the same moment, base delay = 1 second, and this is their 3rd retry attempt (attempt = 3), so the backoff cap is:
cap=1s×23=8 secondsWithout jitter: every one of the 1000 clients computes the identical 8-second delay and retries at exactly the same instant, a spike of 1000 concurrent requests hitting the dependency in one moment, right as it may just be starting to recover.
With full jitter, each client independently draws a delay uniformly from [0,8] seconds. Dividing that 8-second window into 100 ms buckets gives 8000/100=80 buckets, and under a uniform distribution the expected number of clients landing in any single bucket is:
801000=12.5 requests per 100ms bucketThat's a peak-to-average reduction factor of 1000/12.5=80× under this modeling assumption (uniform, independent draws), turning one instantaneous spike of 1000 into a smooth trickle of roughly 12-13 requests every 100 ms across the full 8-second window, which a recovering dependency can absorb where a single 1000-request spike would knock it back down.
Why retries shouldn't make recovery worse
Jitter alone doesn't prevent the retry storm from getting worse over time if attempts aren't capped: a client that keeps failing and keeps retrying at base×2attempt forever will eventually be sending requests at a cap so large it's functionally giving up, or, worse, if the cap is bounded, converges back to a steady drumbeat of load that never lets the dependency fully recover. The fix is a hard cap on both the maximum delay and the maximum number of attempts, plus honoring any explicit signal the server provides (a Retry-After header or a 429/503 status) as authoritative over the client's own backoff schedule, since the server is in the best position to know its own recovery state.
Trade-offs and pitfalls
Full jitter maximizes spread but means some unlucky clients draw a near-zero delay and retry almost immediately, which is fine in aggregate (that's still only ~12-13 requests per 100ms bucket in the example above) but means full jitter alone doesn't guarantee a minimum backoff for any individual client; equal jitter trades some of that spread for a guaranteed floor, useful when even a small number of near-instant retries is unacceptable. A pitfall specific to mobile or otherwise unreliable-network clients: retries are only safe to jitter and reattempt if the underlying operation is idempotent (repeating it produces the same end result as doing it once, so a duplicate attempt is harmless), a non-idempotent submit (a payment, an order) retried after a client-side timeout can double-execute if the server had actually processed the first attempt and just failed to deliver the response, so the fix belongs on the server (idempotency keys deduping identical requests) not just in the client's backoff logic, jitter reduces load, it does not make an unsafe retry safe.
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.
Unlock Full Question Bank
Get access to all 45 Fault Tolerance, High Availability, and Disaster Recovery interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.