SLI · 30 DAYS–≥SLO99.9%ERROR BUDGET LEFT–LOGSMETRICSTRACEINFO paidERROR timeoutWARN retry 1INFO paidshopbreakerpaymentsA · UP01B · UPON-CALLCLOSEDOK1for n in range(4):2 try:3 ok = pay(timeout=2)4 break5 except TimeoutError:6 cap = 0.1 * 2**n7 sleep(uniform(0, cap))1What happened2Impact on users3Why the system let it4Fixes, each with owner
Middle row: users, the shop (copies A and B), the circuit breaker and paymentsBack row: the dashboard, the alert lamp and the on-call engineer; front: the retry code and the postmortemTokens: envelopes are requests and calls, X is a failure, a check is an answer, dots are logs, metrics and tracesMiddle row: users, the shop service running as two copies, a circuit breaker and the payments service the shop depends on. Back row: a dashboard, an alert lamp and the on-call engineer. Front: the Python retry code and the postmortem. Copy A crashes and B carries on; a slow payment call times out after 2 s; retries wait longer each time, with a random part; after repeated failures the breaker's lever swings open, then a test call closes it again. The dashboard shows logs, metrics and a trace, then the success rate (99.94%) against its 99.9% target and the error budget left (40%). The lamp pages the on-call engineer, who writes a blameless postmortem. The 2-second timeout, the 5-failure threshold, the 30-second cool-down, the traffic and the size of the outage are example values; real ones are tuned for each service. The arithmetic on them is exact.

Design for failure

  1. Users buy through a shop service, which calls a payments service. Machines crash, networks drop and services slow down, every day. Reliability means users still get a working shop, so you design for failure from the start.

Measure what users feel

When it breaks

What happens

;; step 1/11 · things-fail
users → shop → payments → shop → users
every part can fail:
  a machine crashes
  the network drops packets
  a service it depends on gets slow
reliability: users still get a working shop

The 2-second timeout, the 5-failure threshold, the 30-second cool-down, the traffic and the size of the outage are example values; real ones are tuned for each service. The arithmetic on them is exact. Requests reach a healthy copy through a load balancer, which checks each copy and stops sending it traffic when it fails. The figure leaves the load balancer out.