Course contents

01. System Design Fundamentals Lesson 7 of 8

Reliability

Watch faults turn into failures, see how MTTR, redundancy, health checks and retries limit the damage, and why slow servers are harder to catch than dead ones.

14 minBeginner9 steps
Loading the interactive simulation…
Loading the knowledge check…

Summary

  • Faults are inevitable; reliability is about how many of them become failures that users see.
  • Availability ≈ MTBF ÷ (MTBF + MTTR): repairing twice as fast is worth as much as failing half as often.
  • Redundancy plus detection limits a crash to the detection window; retries can hide even that.
  • A slow but live server passes liveness checks and soaks up traffic and retries; detect faults by behaviour.
  • Redundancy assumes independent faults; shared racks, deploys and dependencies break that assumption.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

A system is reliable when it keeps delivering correct service over time, even though parts of it go wrong. Two terms make this precise:

  • A fault is one component deviating from its specification: a process crashes, a disk returns errors, a network link drops packets, a dependency slows down, a deploy ships a bug.
  • A failure is the system as a whole not delivering the service users expect: errors, wrong answers or answers too late to be useful.

Faults cause failures only when nothing stops them. Fault tolerance is the set of techniques that keep faults from becoming failures. Reliability is closely related to availability (the share of time or requests served), but broader: a system that answers quickly with wrong data is available and not reliable.

Why it exists

At scale, faults are not exceptional events; they are a steady background rate. Hard disks have annual failure rates of around 1–2% in large published fleets; with tens of thousands of disks, several fail every day. Add kernel bugs, bad deploys, expired certificates, overloaded dependencies and human mistakes, and something in a large system is always broken. Designing for "nothing fails" is designing for a system that does not exist. Reliability engineering accepts faults and limits how often and how badly they reach users.

How it works

Measure from the outside. Reliability is judged by users, so the main signals are the error rate and latency of real requests (later formalised as SLIs and SLOs), not whether every process is running.

MTBF and MTTR. Mean time between failures (MTBF) says how often a component fails; mean time to repair (MTTR) says how long it stays broken. For a single component, availability ≈ MTBF ÷ (MTBF + MTTR). MTTR includes time to detect, time to decide and time to fix, which is why teams also track mean time to detect. The formula shows two equal levers: fail less often, or repair faster. In the lesson, cutting repair from 600 ms to 200 ms took the failed share from about 30% to about 10% without changing how often the server crashed. In practice, automatic restarts, health-checked rollouts, quick rollbacks and good alerting are usually cheaper than making a component fail less.

Redundancy and detection. A spare that can carry the load, plus something that notices the fault and routes around it, turns a crash into a short blip. A load balancer's health checks are the classic example: probe every interval, eject after a number of consecutive failures. The damage is limited to the detection window (interval × threshold, plus requests already in flight).

Retries. Many faults are transient or affect one instance. If a request fails, sending it again, ideally to a different instance, often succeeds. Retries hide the detection window, but they need idempotent operations (or idempotency keys), limited attempts, and exponential backoff with jitter so that a fleet of clients does not hammer a recovering system at the same instant.

Partial faults. The hardest faults are not crashes. A server that is slow because of a failing disk, a noisy neighbour, a memory leak or lock contention still answers health probes, so it stays in rotation. Clients time out, retry and add load. These gray failures need behaviour-based detection: latency and error rate per backend, least-outstanding-requests balancing, outlier detection that ejects a backend whose metrics stand out, and deep health checks that exercise real work.

Independence. Redundancy multiplies away failure probability only if faults are independent. Two replicas on the same rack, behind the same switch, running the same bad build or depending on the same database fail together. Spreading replicas across failure domains (hosts, racks, zones, regions), staging deploys and limiting shared dependencies is what makes redundancy real.

When to use it

Every production service needs a reliability target and the basics: monitoring of user-facing errors and latency, automatic restart, more than one instance for anything users depend on, and safe retries at the edges. The more expensive techniques (multi-zone and multi-region redundancy, outlier detection, chaos experiments) scale with how much failures cost: revenue, safety, contractual SLAs.

When not to

  • Batch jobs that can simply be re-run rarely need live redundancy; checkpoints and idempotent re-runs are enough.
  • Retries are wrong for non-idempotent operations without deduplication, and harmful when the fault is overload: they add load exactly when there is none to spare.
  • Do not chase nines that users do not need. Each extra nine costs far more than the last, and an error budget is often better spent on features.

Trade-offs

Choice You gain You pay
Redundant instances Crashes become blips Cost of spare capacity; state must be shared or replicated
Short health check intervals Faster detection, smaller error window More probe traffic; more false ejections during brief hiccups
Client retries Transient faults hidden from users Extra load, retry storms if unbounded, duplicates for non-idempotent calls
Deep health checks Catch broken dependencies A shared dependency failing can eject every instance at once
Outlier detection Catches slow or erroring instances Tuning; may eject too many instances if the whole fleet degrades

Alternatives

  • Graceful degradation: when a non-essential part fails, serve a reduced experience (cached recommendations, read-only mode) instead of an error.
  • Circuit breakers: stop calling a failing dependency for a while, fail fast and give it room to recover.
  • Bulkheads: isolate resources per dependency or tenant so one fault cannot exhaust everything.
  • Checkpoint and restart: for batch and stream processing, recover by replaying from the last consistent point instead of running hot spares.

Failure modes

  • Correlated faults: replicas sharing power, network, configuration or a release fail together.
  • Retry storms: thousands of clients retrying without backoff turn a short fault into a sustained overload.
  • Gray failures: a slow or partially broken instance stays in rotation because liveness checks pass.
  • Cascading failure: an ejected instance's traffic overloads the survivors, which then fail too.
  • Hidden latent faults: a standby that has never been exercised fails when it is finally needed. Test failover regularly.
  • Slow detection: alerts on averages or on host metrics miss user-facing errors; MTTR is dominated by time to notice.

In production

Teams define SLOs on user-facing error rate and latency and alert on error-budget burn rate rather than on individual hosts. They run several instances across availability zones, use health-checked load balancing with outlier detection (service meshes and modern proxies support it), and give clients timeouts, bounded retries with jitter and idempotency keys. Deploys roll out gradually with automatic rollback. Chaos experiments and game days inject faults deliberately to prove that redundancy and runbooks work. Blameless postmortems feed fixes back into both MTBF and MTTR.

Common misconceptions

  • "Reliable means nothing ever breaks." Something always breaks; reliable means users rarely notice.
  • "Redundancy guarantees availability." Only for independent faults, and only with detection and enough spare capacity.
  • "If the health check is green, the server is fine." Liveness checks miss slow, overloaded or half-broken servers.
  • "Retries are free reliability." They cost load and can duplicate side effects; without backoff and limits they make outages worse.
  • "MTBF is the only number that matters." Faster repair improves availability just as much and is often cheaper.

Interview angle

Use the vocabulary precisely: faults versus failures, MTBF and MTTR, detection window. When you add redundancy, say how faults are detected and how long that takes, and whether the survivors can carry the load. Mention client timeouts, bounded retries with jitter and idempotency. Strong candidates bring up partial failures (slow nodes, gray failures) and correlated failures (same zone, same deploy) without being prompted, and explain how they would detect and contain them.

Model assumptions

The simulation is a simplified model, not a benchmark. App servers have 6 workers, a lognormal service time of 40 ms mean (cv 0.3) and room for 20 waiting requests. Users send 60 requests per second (Poisson arrivals) and time out after 250 ms; from the retries step on they retry up to two more times with exponential backoff (20 ms base, full jitter). The load balancer probes every 250 ms (2 failures eject, 2 successes restore) and only checks whether a server is up. A degraded server runs four times slower. The crash/repair cycles compress weeks of MTBF into seconds so the pattern is visible; the ratios between MTBF and MTTR are the point, not the durations. Outlier detection and deep health checks are described but not simulated.

The lesson as textEvery step of the simulation, written out.
  1. 1. Reliable means correct, over time

    A system is reliable when it keeps doing what users expect, correctly, despite things going wrong inside it. We measure that from the outside: the error rate, the share of requests that fail.

    One server handles 60 requests per second. It is about 40% busy and the error rate is zero. Nothing has gone wrong yet.

    Scene: Users send 60 requests per second to one app server. Every request succeeds.

    Key idea: Reliability is judged by users: the share of requests that get a correct answer in time.

  2. 2. With no spare, every fault is a failure

    Two words that are easy to mix up. A fault is one component going wrong: a process crashes, a disk dies, a link drops. A failure is the system as a whole not delivering the service: users get errors.

    One second in, App 1 crashes, and it is restarted 800 ms later. With a single server the fault turns into a failure immediately: every request in that window fails. As soon as App 1 is back, the errors stop.

    Scene: App 1 crashes for 0.8 seconds. Every request in that window fails; once App 1 restarts, requests succeed again.

    Key idea: Faults are inevitable. Reliability engineering is about stopping faults from becoming failures.

  3. 3. How often, and how long

    Faults repeat. Two numbers describe the pattern: MTBF, the mean time between failures, and MTTR, the mean time to repair. Here App 1 crashes every 2 seconds and takes 600 ms to come back (time is compressed: think every few weeks and half an hour).

    The share of time it is up is MTBF ÷ (MTBF + MTTR). Watch the error rate settle around 30%: the fraction of time spent down.

    Scene: App 1 crashes every two seconds and is down for 600 ms each time. About 30% of requests fail.

    Key idea: Availability ≈ MTBF ÷ (MTBF + MTTR). You can improve it by failing less often or by repairing faster.

  4. 4. Halving MTTR halves the downtime

    Same crash rate, but now a supervisor restarts App 1 automatically in 200 ms instead of 600 ms. The faults happen exactly as often; each one just hurts for less time.

    The error rate drops to around 10%. In real systems this is often the cheapest win: fast detection, automatic restarts, quick rollbacks and good runbooks shrink MTTR without touching MTBF.

    Scene: App 1 still crashes every two seconds but restarts after 200 ms. About 10% of requests fail.

    Key idea: Repairing faster is often cheaper than failing less: automate detection and restart.

  5. 5. A redundant pair with health checks

    Instead of repairing faster, add a spare: App 2 behind a load balancer that probes both servers every 250 ms. Either server can carry all the traffic alone.

    One and a half seconds in, App 1 crashes and stays down. The requests the balancer sends it before two probes have failed still fail; after that App 2 serves everything and the error rate returns to zero. The fault is now a short blip instead of an outage.

    Scene: A load balancer spreads traffic over App 1 and App 2. App 1 crashes; a few requests fail until health checks eject it about half a second later, then App 2 serves everything with no errors.

    Key idea: Redundancy plus detection limits a fault’s damage to the detection window.

  6. 6. Retries hide the detection window

    App 1 is repaired. The clients now retry a failed request up to two more times, after a short random delay (backoff with jitter). Same crash, same moment.

    A request refused by the dead App 1 is retried, and the balancer’s next pick is usually App 2. The retry counter jumps, but users see almost no errors at all. The fault happened; the failure did not. That is fault tolerance.

    Scene: Clients retry failed requests. App 1 crashes again; the retries land on App 2, so the retry count rises while almost no request fails.

    Key idea: Retrying on a redundant system masks transient faults, as long as the request is safe to repeat.

  7. 7. A fault the health check cannot see

    App 1 is back. One second in, App 2 degrades: a noisy neighbour, a failing disk or a memory leak makes it four times slower. It is still up, so it passes every health check and stays in rotation.

    Round robin keeps sending it half the traffic. Many of its requests now take over 250 ms, clients give up and retry, and the retries add even more load. Timeouts climb and P95 jumps, while the balancer reports both servers healthy. Partial faults like this, sometimes called gray failures, are harder than crashes because nothing looks broken.

    Scene: App 2 becomes four times slower but stays up. The load balancer keeps it in rotation; requests sent to it time out, timeouts and retries rise and P95 latency jumps.

    Key idea: A slow component is often worse than a dead one: it passes liveness checks and soaks up work and retries.

  8. 8. Route by how servers behave

    Switch the balancer to least connections. A slow server holds its requests longer, so its count of work in progress stays high and it gets picked less often. Traffic drains towards App 1 on its own.

    Timeouts fall sharply and P95 recovers, though App 2 is still sick. Production systems go further with outlier detection (eject a backend whose latency or error rate stands out), deep health checks that test real work, and alerting on latency, not just on up/down.

    Scene: With least connections the load balancer sends most requests to App 1. Timeouts drop sharply and P95 latency recovers, although App 2 is still degraded.

    Key idea: Detect faults by behaviour (latency, errors, work in progress), not only by liveness.

  9. 9. Engineering for faults

    Faults will happen; reliability is how many of them reach users. You saw three levers: repair faster (MTTR), add redundancy with detection, and mask transient faults with retries. And one trap: partial faults that liveness checks miss.

    Two more limits to keep in mind. Redundancy only helps against independent faults: two servers on the same rack, the same bad deploy or the same expired certificate fail together. And retries need idempotent requests and a budget, or they turn a small fault into an overload.

    Scene: Users with retries, a load balancer using least connections, the healthy App 1 and the still-degraded App 2. Most requests succeed.

    Key idea: Reliability = fewer faults × less damage per fault. Redundancy, detection and safe retries limit the damage; independence makes redundancy real.