The idea in one minute#
Reliability becomes useful when it is a number. Availability is the fraction of time (or of
requests) a service works. Two numbers drive it: how often it fails (MTBF, mean time between
failures) and how long each failure lasts (MTTR, mean time to restore). Availability is
roughly MTBF / (MTBF + MTTR) — so you can improve it by failing less or by recovering faster,
and recovering faster is usually cheaper.
When services depend on each other, their availabilities multiply. Five dependencies at 99.9% each give at most 99.5%. Redundancy works the other way: two independent copies at 99% give 99.99%. Those two rules explain most architecture decisions in this material.
An analogy#
A string of old Christmas lights wired in series: one bulb fails and the whole string goes dark, so the more bulbs, the more often it is dark. Wire them in parallel and the string stays lit unless every bulb fails at once. Dependencies called one after another are in series; redundant replicas behind a load balancer are in parallel.
A picture#
flowchart LR
subgraph SERIES["In series: all must work — multiply availabilities"]
direction LR
A1["API<br/>99.95%"] --> A2["Auth<br/>99.9%"] --> A3[("DB<br/>99.95%")]
end
subgraph PARALLEL["In parallel: one must work — multiply unavailabilities"]
direction LR
LB["Load balancer"] --> R1["Replica A<br/>99%"]
LB --> R2["Replica B<br/>99%"]
end
SERIES --> S1["0.9995 × 0.999 × 0.9995<br/>= 99.80%"]
PARALLEL --> P1["1 − 0.01 × 0.01<br/>= 99.99%"]
class A1,A2 compute
class A3 memory
class LB queue
class R1,R2 compute
class S1 warn
class P1 ioHow it really works#
The nines#
| Availability | “Nines” | Down per 30 days | Down per year |
|---|---|---|---|
| 99% | two | 7 h 12 min | 3.65 days |
| 99.9% | three | 43 min | 8.8 h |
| 99.95% | three and a half | 21.6 min | 4.4 h |
| 99.99% | four | 4.3 min | 53 min |
| 99.999% | five | 26 s | 5.3 min |
Each extra nine is ten times less allowed failure and, as a rule of thumb, roughly ten times the engineering cost.
Time-based versus request-based availability#
- Time-based:
uptime / total time. Easy to explain, but treats a quiet 3 a.m. outage the same as a peak-hour one, and has no good answer for “partially down”. - Request-based:
good requests / total requests. Weights failure by how many users felt it, handles partial failure naturally, and is what modern SLOs use (Module 2).
The failure timeline#
flowchart LR F["Failure<br/>starts"] -->|"MTTD<br/>detect"| D["Someone<br/>knows"] D -->|"MTTA<br/>acknowledge"| K["Someone<br/>is working"] K -->|"mitigate"| M["Users OK<br/>again"] M -->|"repair"| R["Root cause<br/>fixed"] R -->|"MTBF"| F2["Next<br/>failure"] class F,F2 warn class D,K queue class M io class R compute
| Term | Meaning | Lever to improve it |
|---|---|---|
| MTTD — mean time to detect | Failure start → first alert or report | Better SLIs, black-box probes, burn-rate alerts |
| MTTA — mean time to acknowledge | Alert → a human is on it | Paging tool, rotation health, fewer noisy alerts |
| MTTR — mean time to restore (or recover) | Failure start → users are fine | Rollback, failover, feature flags, runbooks |
| MTBF — mean time between failures | One failure → next | Testing, canaries, removing single points of failure |
“MTTR” is used for three different things (repair, recovery, respond). Say which one you mean. In this material MTTR means restore: until users are fine, not until the root cause is fixed.
warning
Mean times hide a lot. Incident durations are heavily skewed — a few long incidents dominate the average — so a team’s “MTTR went down” is often noise. Module 5.d covers what to track instead. Use these terms for reasoning, not as team targets.
Availability from failure and recovery#
availability ≈ MTBF / (MTBF + MTTR)A service that fails every 30 days and takes 1 hour to restore: 720 / 721 = 99.86%. Halve the
restore time to 30 minutes: 99.93%. Doubling the time between failures to 60 days gives the same
99.93% — but halving recovery time is usually much cheaper (a rollback button, an automatic
failover) than halving the failure rate.
Dependencies in series#
If a request needs every component to work, and failures are independent:
A_total = A_1 × A_2 × … × A_nA front end (99.99%) calling an API (99.95%) that calls auth (99.9%), a database (99.95%) and a
cache (99.9%) is at most 0.9999 × 0.9995 × 0.999 × 0.9995 × 0.999 = 99.69%. A service
cannot be more available than its hard dependencies multiplied together. This is why the
Google rule of thumb is that a service’s critical dependencies should each be about ten times
more reliable than the service itself (one more nine).
Redundancy in parallel#
If any one of n independent copies is enough:
A_total = 1 − (1 − A)^nTwo copies at 99%: 1 − 0.01² = 99.99%. Three: 99.9999%. The catch is the word
independent. Two replicas in the same rack, behind the same switch, running the same bad
config, fail together. Real redundancy needs separate failure domains (Module 7.a) and correct,
tested failover — the failover mechanism itself has an availability and sits in series.
Soft dependencies#
A dependency is soft if the service can still answer (degraded) without it: recommendations on a product page, a spell-checker, analytics. Soft dependencies do not multiply into your availability — if, and only if, you have tested that their failure really is survived (Module 6.f, Module 10). Turning hard dependencies into soft ones is one of the highest-value reliability changes there is.
A worked example#
An online shop’s checkout page has this request path: CDN (99.99%) → web tier (99.95%) → checkout API (99.95%) → payments provider (99.9%) and inventory DB (99.95%). It also calls a recommendation service (99.5%) to show “people also bought”.
- Series of hard dependencies:
0.9999 × 0.9995 × 0.9995 × 0.999 × 0.9995 = 99.74%. - Recommendations as a hard dependency (today, the page errors if it fails): multiply by 0.995 → 99.24%. That is 5.5 hours of failure a month, and recommendations cause most of it.
- Make recommendations soft (time out at 100 ms, render the page without them): back to 99.74%, and a 99.7% SLO is now achievable.
- Add a second payments provider with automatic failover (each 99.9%, failover logic
99.99%): payments become
(1 − 0.001²) × 0.9999 ≈ 99.99%. Checkout is now0.9999 × 0.9995 × 0.9995 × 0.9999 × 0.9995 ≈ 99.83%.
The single cheapest change — a 100 ms timeout and a fallback on a non-essential call — bought more than half a nine.
Code#
// availability.go — series, parallel and MTBF/MTTR arithmetic for a request path.
package main
import (
"fmt"
"time"
)
type component struct {
name string
avail float64
replicas int // independent copies; any one is enough
soft bool // failure is survived by degrading
}
func effective(c component) float64 {
n := c.replicas
if n < 1 {
n = 1
}
down := 1.0
for i := 0; i < n; i++ {
down *= 1 - c.avail
}
return 1 - down
}
func path(cs []component) float64 {
total := 1.0
for _, c := range cs {
if c.soft {
continue
}
total *= effective(c)
}
return total
}
func monthly(a float64) time.Duration {
return time.Duration(float64(30*24*time.Hour) * (1 - a)).Round(time.Minute)
}
func main() {
before := []component{
{"cdn", 0.9999, 1, false},
{"web", 0.9995, 1, false},
{"checkout-api", 0.9995, 1, false},
{"payments", 0.999, 1, false},
{"inventory-db", 0.9995, 1, false},
{"recommendations", 0.995, 1, false},
}
after := []component{
{"cdn", 0.9999, 1, false},
{"web", 0.9995, 1, false},
{"checkout-api", 0.9995, 1, false},
{"payments", 0.999, 2, false}, // second provider
{"failover-logic", 0.9999, 1, false},
{"inventory-db", 0.9995, 1, false},
{"recommendations", 0.995, 1, true}, // now soft
}
for _, p := range []struct {
name string
cs []component
}{{"before", before}, {"after", after}} {
a := path(p.cs)
fmt.Printf("%-7s availability %.3f%% ≈ %v down per 30 days\n", p.name, a*100, monthly(a))
}
fmt.Println("\nMTBF / (MTBF + MTTR), failing every 30 days:")
mtbf := 30 * 24 * time.Hour
for _, mttr := range []time.Duration{4 * time.Hour, time.Hour, 30 * time.Minute, 5 * time.Minute} {
a := float64(mtbf) / float64(mtbf+mttr)
fmt.Printf(" restore in %-8v → %.3f%%\n", mttr, a*100)
}
}The second table is the argument for investing in recovery: going from a 1-hour to a 5-minute restore (an automated rollback) moves the service from about 99.86% to 99.99% without failing any less often.
Remember this#
- Availability ≈ MTBF / (MTBF + MTTR). Faster recovery is usually the cheaper lever.
- Hard dependencies multiply: you cannot beat the product of your critical path.
- Independent redundancy multiplies unavailability:
1 − (1 − A)^n. “Independent” is the hard part. - Make non-essential dependencies soft, and test that they really are.
- Prefer request-based availability; say which “MTTR” you mean.
Try it#
- Run
availability.go. Make inventory-db redundant (two replicas). How much does it buy? - Draw the request path of a service you know. Mark each dependency hard or soft. What is the best availability it could possibly have?
- Your service needs 99.95%. It has four hard dependencies. How available must each be, if they are equal?
Check yourself#
- Two independent services at 99.9% are called in series. What is the combined availability?
- Two replicas at 99.5% each, independent, either one enough. What is the combined availability? Name one reason it will be lower in reality.
- Why does a 99.99% SLO practically require automated recovery?
- What makes a dependency “soft”, and why must that be tested?
Sources#
- Google SRE book, chapter 3: Embracing Risk — time- versus request-based availability
- Google SRE book, chapter 4: Service Level Objectives
- Ben Treynor et al., “The Calculus of Service Availability”, ACM Queue (2017) — the “rule of the extra 9” for dependencies