Free preview

Fault Tolerance: Redundancy, Failover, and Error Recovery

Why this matters: availability and reliability are outcomes you want. Fault tolerance is the machinery that produces them. This is where the abstract targets from the last three lessons turn into replicas, failover policies, and money.

Key takeaway

Fault tolerance is a system's ability to continue operating even when one or more components — software or hardware — fail. Achieving 100% fault tolerance is practically impossible; systems aim to maximize persistence and minimize disruption.

Why it is mandatory at scale

Large-scale applications run hundreds of servers and databases to serve billions of users. At that size, component failure is not a possibility to plan for — it is a daily occurrence. These systems must eliminate single points of failure, both to keep data safe and to avoid redoing computationally expensive work every time a machine dies.

Fault tolerance rests on the two qualities from the previous lessons:

  • Availability — the system remains accessible and receives client requests at any time.
  • Reliability — the system consistently processes requests and performs the correct actions.

Two approaches to a single point of failure

ApproachStrategyMechanismWhen it applies
Fault removalDetect the error and correct the stateForward or backward error recoveryThe fault is recoverable in place
Fault maskingPrevent the fault from affecting output at allRedundancyYou have spare capacity to absorb the loss

Fault masking is what most distributed systems lean on: keep enough redundant copies that a failure never becomes visible to a user. Fault removal is what you fall back on when masking isn't possible.

Forward and backward error recovery

Forward error recovery identifies the error state and corrects it, driving the system onward to a valid state — classically, exception handling (as in Ada or PL/1). You know what went wrong and how to fix it in place.

Backward error recovery restores the system to a stable state that existed before the fault. You don't need to understand the error — you only need a known-good state to return to. This is what checkpointing implements, and it's the subject of the next lesson.

Recovery typeRequiresCostExample
ForwardKnowing the error and its correctionCheap — no state to storeCatch the exception, substitute a default, continue
BackwardA saved prior stateStorage plus lost work since the saveRoll back the transaction; restore the checkpoint

Failover strategies

When a component dies, how fast does its replacement take over? That is a cost decision:

ModeBackup stateDowntime on failureResource cost
HotRunning, warm, receiving updatesEffectively zeroHighest — you pay for idle capacity
WarmRunning but not fully currentSeconds to minutesModerate
ColdNot running; started on demandMinutes to hoursLowest

Hot failover instantly transfers workloads to a functioning backup, giving zero downtime. Warm or cold failover loads and starts the backup only when needed — a delay, but far fewer resources consumed.

Map this straight onto your availability target: at 99.99% you have about 4 minutes of budget per month, so cold failover is arithmetically impossible and even warm is tight. Your availability number chooses your failover mode for you.

Replication

Replication-based fault tolerance duplicates services and data. If a node fails, the system transparently swaps it with a healthy replica. It is the dominant fault-masking technique in practice.

Keeping replicas updated forces the trade-off from Chapter 1:

Update modeConsistencyAvailabilityCost
SynchronousStrong — replicas agree before acknowledgingReduced — a slow or dead replica blocks the writeWrite latency bounded by the slowest replica
AsynchronousEventual — replicas lag; stale reads possibleHigher — writes succeed even if replicas are downData loss window if the primary dies before replicating

Synchronous updates ensure strong consistency but reduce availability. Asynchronous updates improve availability but result in eventual consistency and stale reads. This trade-off is central to the CAP theorem — the same decision, arrived at from the fault-tolerance direction rather than the consistency direction.

Sizing redundancy

How many spares? Two standard postures:

ModelMeaningSurvivesCost overhead
N+1One spare beyond what load requiresAny single failureLow — one extra unit
N+2Two sparesA failure during planned maintenanceModerate
2NA full duplicate setLoss of an entire set — a whole AZ or DC100%
2N+1Full duplicate plus a spareA DC loss plus a component failureHighest

Blast radius

The mature framing is not "will this fail?" but "when it fails, how much goes with it?"

Cell-based architecture partitions the fleet into independent cells, each a full stack serving a slice of users. A bad deploy or a poison request takes down one cell — a third of users, or a tenth — instead of everyone. Combined with staged rollouts, it converts total outages into partial ones, which is often the difference between an incident and a catastrophe.

Related tactics worth naming:

  • Bulkheads — separate resource pools per dependency, so one saturated downstream can't consume every thread.
  • Graceful degradation — shed features, not the whole service. Recommendations off, checkout still works.
  • Static stability — the system keeps running on its last-known-good configuration when the control plane is unreachable, rather than failing because it can't ask permission.

The cost side

The primary purpose of fault tolerance is to prevent system unavailability, which is critical for safety-critical systems (air traffic control) and platforms requiring high data integrity. But these systems are expensive: they require redundant hardware and complex synchronization logic, and that complexity is itself a source of failure.

Key takeaway

Fault tolerance is bought, not wished for. Every nine costs redundant capacity, synchronization machinery, and operational complexity. The engineering skill is spending it where a failure actually hurts — and consciously leaving the rest to degrade.

Interview signal by level

LevelWhat a strong answer sounds like
L4"We'll have replicas so if one fails another takes over."
L5Specifies the mechanism: "hot standby with health-checked automatic failover, and semi-sync replication to bound data loss."
Staff+Sizes and contains it: "three replicas at a 66% utilization ceiling so losing one doesn't cascade. Redundancy only covers independent faults, so bad code is handled by canaries and rollback instead. And I'd cell-partition to cap blast radius at a third of users."

Next: what backward error recovery actually requires — and why saving state is harder than it sounds.

Enjoying the preview?

Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.

Sign up free to continue