Course contents

01. System Design Fundamentals Lesson 6 of 8

Availability

Measure availability, turn nines into downtime, find single points of failure, and see how redundancy, health checks and series/parallel maths set uptime.

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

Summary

  • Availability is the share of requests served correctly (or time up) over a period.
  • Each extra nine allows ten times less downtime: 99.9% is about 8.8 hours a year, 99.99% about 53 minutes.
  • A single point of failure turns any failure of that component into an outage.
  • Redundancy needs spare capacity and automatic failover; errors still occur during detection.
  • Series dependencies multiply availabilities; independent parallel copies multiply failure chances.
Deep diveHow it works, trade-offs, failure modes, misconceptions and the interview angle.

What it is

Availability is the degree to which a service is ready to answer correctly when asked. It is measured over a period, either as uptime (the fraction of time the service was usable) or, more usefully for request-driven systems, as the fraction of requests that succeeded. It is usually expressed in "nines": 99.9% ("three nines") or 99.99% ("four nines").

Why it exists

Hardware fails, processes crash, deployments go wrong, networks partition and whole data centres lose power. Users and businesses depend on services being there anyway: an hour of checkout downtime is lost revenue, and an unavailable authentication service takes every dependent product down with it. Availability turns "it should be up" into a number that can be promised, measured and designed for.

How it works

Downtime budgets. Each nine cuts allowed downtime tenfold:

Target Downtime per year Per 30-day month
99% ~3.7 days ~7.2 hours
99.9% ~8.8 hours ~43 minutes
99.99% ~53 minutes ~4.3 minutes
99.999% ~5.3 minutes ~26 seconds

Availability can also be described as MTBF ÷ (MTBF + MTTR): how long a component runs between failures versus how long a repair takes. You raise it by failing less often or by recovering faster, and beyond three nines mostly by recovering automatically.

Redundancy and failover. Run more than one copy of each component, put something in front that routes around failed copies (a load balancer with health checks, a database failover manager, DNS), and make sure the remaining copies can carry the load. A failure then costs only the requests in flight plus those sent during the detection window: probe interval × failures needed to eject.

Series and parallel. Components a request needs one after another multiply: three components at 99.9% give at most about 99.7%. Independent redundant copies fail only together: two 99% copies give 1 − 0.01² = 99.99%. The independence assumption is crucial; copies in the same rack, zone, or running the same bad deployment fail together.

When to use it

Set an explicit availability target for every user-facing or widely depended-upon service, and derive the architecture from it. Internal tools may be fine at 99%; a payment API or identity provider may need 99.99% and multiple zones. Write targets as service level objectives and measure them from the user's point of view.

When not to

Do not chase nines the business does not need. Each one roughly multiplies cost and complexity: multi-zone databases, multi-region traffic management, on-call rotations, chaos testing. Also, a service cannot be meaningfully more available than the things its users need anyway, such as their own network connection or a critical upstream dependency.

Trade-offs

Choice You gain You pay
Redundant instances (N+1) Survives one failure Idle capacity, load balancer to run
Multiple zones Survives a data-centre failure Cross-zone latency and traffic cost
Multiple regions Survives a regional outage Data replication, consistency conflicts, much higher complexity
Aggressive health checks Short detection window Probe load, false ejections on brief hiccups
Deep health checks (test dependencies) Detect broken dependencies One shared dependency failure can eject every instance
Database replication with automatic failover Survives a database host failure Replication lag, risk of split brain, failover time

Alternatives

Where full redundancy is too expensive, graceful degradation keeps the core working when a part fails: serve cached or default content, disable recommendations, queue writes for later. Static stability designs systems so they keep running on their last known good state when a control plane is unavailable. These do not raise uptime of the failed part, but they raise the availability users experience.

Failure modes

  • Hidden single points of failure: one load balancer, one database primary without standby, one DNS provider, one configuration service, one region.
  • Correlated failures: redundant copies on the same host, rack or zone, or all updated by the same bad deployment at once.
  • No spare capacity: failover moves load onto survivors that are already near their limit, turning one failure into overload of all.
  • Health checks that miss the problem: probes succeed while every real request fails, or the reverse.
  • Slow detection or failover: minutes of errors while a failover manager decides what to do.
  • Retry storms: clients retrying during an outage multiply load when the service comes back.

In production

Measure availability as successful requests over total requests at the edge, per endpoint that matters, against an SLO with an error budget. Spread instances over at least two zones, run load balancers redundantly or use managed ones, and use databases with automatic failover. Deploy gradually (canaries, rolling updates) because changes cause a large share of outages. Rehearse failures: kill instances, fail over databases and test restores, so recovery is routine rather than improvised.

Common misconceptions

  • "Redundancy means no errors." Requests during the detection window and those in flight on the failed copy still fail unless clients retry safely.
  • "Two servers double availability." They multiply the chance of failure, and only if failures are independent and failover is automatic.
  • "Availability and reliability are the same." Availability is about being up and answering; reliability includes answering correctly and not losing data over time.
  • "Five nines is the goal." The right target is the one users and the business need; beyond it, money is better spent elsewhere.

Interview angle

State the target first ("99.95% for the API"), then walk the request path and remove single points of failure one by one: balancer pair, instances across zones, replicated database with failover, maybe multi-region for the most critical paths. Do the series arithmetic out loud, mention N+1 capacity and detection time, and call out what you would degrade gracefully rather than make fully redundant.

Model assumptions

The simulation is a simplified model, not a benchmark. App servers have 6 workers and a 50 ms mean service time; one server alone can carry the 60 requests per second. The load balancer probes every 500 ms; 2 failed probes eject a server and 2 good ones restore it. Health checks see only whether a server process is up, not whether its database works. A crashed component refuses connections immediately; in-flight requests on it fail. Clients do not retry unless the challenge enables it. Arrivals are random (Poisson). Numbers show behaviour and orders of magnitude only.

The lesson as textEvery step of the simulation, written out.
  1. 1. Available means answering correctly

    A service is available when it answers requests correctly. The usual measure is the share of requests that succeed, or the share of time the service is up: “99.9% available”.

    Right now one server handles 60 requests per second and every one succeeds. Availability is 100%, for the moment.

    Scene: Users send 60 requests per second to App 1. Every request succeeds.

    Key idea: Availability = successful requests ÷ all requests (or uptime ÷ total time), measured over a period.

  2. 2. One server, one outage

    A second in, App 1 crashes; two seconds later it is back. While it is down, every single request fails: users have nowhere else to go.

    App 1 is a single point of failure: one component whose failure takes the whole service down. Over these six seconds, about a third of all requests failed. A real server that took ten minutes to restart once a week would be down about 0.1% of the time.

    Scene: App 1 crashes for two seconds. During that time every request fails; afterwards requests succeed again.

    Key idea: A single point of failure turns any failure of that component into a full outage.

  3. 3. Counting nines

    Availability targets are written in nines. Over a year, 99% allows about 3.7 days of downtime, 99.9% about 8.8 hours, 99.99% about 53 minutes, and 99.999% about 5 minutes.

    Each extra nine cuts the allowed downtime tenfold, and usually costs much more than the previous one. Ten minutes to restart a server is fine at 99%, already a problem at 99.99%. Beyond some point you cannot repair fast enough: you need a spare that takes over automatically.

    Scene: App 1 is running again and every request succeeds. The text compares downtime budgets: 99% is about 3.7 days a year, 99.99% about 53 minutes.

    Key idea: Each nine is ten times less downtime; past 99.9% a person fixing things by hand is too slow.

  4. 4. Two servers and a load balancer

    We add App 2 and put a load balancer in front. Each server takes half the traffic, and either one can carry all 60 requests per second alone.

    The balancer probes both servers every 500 ms. A server that fails two probes in a row is taken out of rotation; one that passes two again is put back.

    Scene: A load balancer spreads requests over App 1 and App 2. Each server is lightly loaded and every request succeeds.

    Key idea: Redundancy means a spare that can carry the load, plus something that routes around failures automatically.

  5. 5. A crash users barely notice

    One and a half seconds in, App 1 crashes again. For a moment the balancer still sends it half the requests, and those fail. Within about a second, two probes have failed and App 1 is out of rotation.

    From then on App 2 serves everything and nothing fails. The outage shrank from “until someone restarts it” to the detection window. Shorter probe intervals shrink it further, at the cost of more probes and more false alarms.

    Scene: App 1 crashes. Requests sent to it fail for about a second, until health checks take it out of rotation; then App 2 serves all traffic without errors.

    Key idea: With redundancy, a failure costs only the errors during detection; afterwards the spare carries the load.

  6. 6. Redundant servers, one database

    App 1 is repaired, and both servers now read from one database. A second and a half in, the database fails. Both servers are up, both pass their health checks, and yet every request fails: neither can answer without its data.

    Redundancy in one tier does not help if everything depends on a single component behind it. Find the single points of failure along the whole request path: databases, DNS, configuration services, a single region.

    Scene: Both app servers use one database. When the database fails, every request fails, although both app servers are up and still in the load balancer’s rotation.

    Key idea: A system is only as available as its weakest single dependency; health checks that do not test it will not notice.

  7. 7. Series and parallel

    The database is back. Components a request needs one after another multiply: a 99.9% load balancer, servers and a 99.9% database give at most about 99.8%. Every dependency in series lowers availability.

    Redundant copies in parallel fail only if all fail at once: two independent 99% servers give 1 − 0.01 × 0.01 = 99.99%. That is why redundancy works, as long as failures really are independent (different machines, racks, zones).

    Scene: Everything is healthy again: users, a load balancer, two app servers and a database. Every request succeeds.

    Key idea: In series: multiply availabilities. In parallel: multiply the chances of failure.

  8. 8. Buying nines

    Availability comes from removing single points of failure (redundant servers, replicated databases, more than one zone), detecting failures quickly, and failing over automatically. Each step costs money and complexity, so pick the target the business needs, not the most nines possible.

    Also remember what this model leaves out: deployments, bad configuration and overload cause many real outages, and a replicated database brings its own failover and consistency questions.

    Scene: The final setup, with the load balancer and the database highlighted as the remaining single points of failure.

    Key idea: Pick an availability target, then remove single points of failure along the whole request path until the maths meets it.