Part 1 of a series on system design for engineers who already ship backend services. Each part takes one problem that hurts real production systems: what breaks, which patterns fix it, and what they cost.
Your service promises 99.9% availability. It needs a database at 99.95%, a cache at 99.95% and an auth service at 99.9% on every request. All three look healthy on their dashboards.
Multiply them and this month’s downtime budget is already gone. Not by a rounding error, and not because of anything you deployed.
Nobody draws that on the whiteboard. The boxes and arrows look fine.
Where interview prep stops
The system design primer has about 375,000 stars on GitHub. It describes itself as a way to “learn how to design large-scale systems” and “prep for the system design interview”.1 Its method has four steps, and the last one is “scale the design”.
That’s a good method for an hour at a whiteboard. The design reviews I’ve sat in ask two more questions. Before the boxes: what are we promising? After them: what does it cost to keep that promise, and who gets woken up when we don’t?
So my checklist starts one step earlier and ends one step later. Five moves: the promise, the math, the failure modes, the operating cost, and a one-page doc that holds all of it.
I’m assuming the lens from DDIA part 1: reliable, scalable, maintainable, and percentiles over averages. I won’t redefine any of it here.
Start with the promise
Google’s SRE book gives the promise three names.2 An SLI is the measurement, like the share of requests that succeed in under 300 ms. An SLO is the target for that measurement, like 99.9% over 30 days. An SLA is a contract with consequences when you miss.
The design review cares about the SLO. The SRE book’s advice on picking one is blunt: don’t pick a target based on current performance, keep it simple, avoid absolutes, have as few SLOs as possible, and perfection can wait.
Then the SLO turns into a budget. “An error budget is 1 minus the SLO of the service.”3 At 99.9% over a million requests, you get 1,000 failures to spend. Google’s example policy says that once the budget is gone, they “halt all changes and releases other than P0 issues or security fixes.”
That’s why the promise comes first. It sets how much failure the design is allowed to have, and every later decision spends from it.
Your dependencies spend it before you do
Availability in series multiplies.1 Three dependencies at 99.95%, 99.95% and 99.9% give you 99.8% at best. Over a 30-day month that’s 86.3 minutes of downtime, and a 99.9% budget is 43.2 minutes. Twice the budget, before you’ve shipped a single bug.
Try other numbers:
Three critical dependencies against a 99.9% budget
Over budget. Dependencies alone: 129.5 min of downtime a month. Over the 43.2-minute budget by 86.3 min, before you ship a bug.
Over budget. Dependencies alone: 107.9 min of downtime a month. Over the 43.2-minute budget by 64.7 min, before you ship a bug.
Over budget. Dependencies alone: 90.7 min of downtime a month. Over the 43.2-minute budget by 47.5 min, before you ship a bug.
Over budget. Dependencies alone: 107.9 min of downtime a month. Over the 43.2-minute budget by 64.7 min, before you ship a bug.
Over budget. Dependencies alone: 86.3 min of downtime a month. Over the 43.2-minute budget by 43.1 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 90.7 min of downtime a month. Over the 43.2-minute budget by 47.5 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 51.8 min of downtime a month. Over the 43.2-minute budget by 8.6 min, before you ship a bug.
Over budget. Dependencies alone: 107.9 min of downtime a month. Over the 43.2-minute budget by 64.7 min, before you ship a bug.
Over budget. Dependencies alone: 86.3 min of downtime a month. Over the 43.2-minute budget by 43.1 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 86.3 min of downtime a month. Over the 43.2-minute budget by 43.1 min, before you ship a bug.
Over budget. Dependencies alone: 64.8 min of downtime a month. Over the 43.2-minute budget by 21.6 min, before you ship a bug.
Over budget. Dependencies alone: 47.5 min of downtime a month. Over the 43.2-minute budget by 4.3 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 47.5 min of downtime a month. Over the 43.2-minute budget by 4.3 min, before you ship a bug.
Within budget. Dependencies alone: 30.2 min of downtime a month. 13.0 min of the 43.2-minute budget left for your own bugs.
Over budget. Dependencies alone: 90.7 min of downtime a month. Over the 43.2-minute budget by 47.5 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 51.8 min of downtime a month. Over the 43.2-minute budget by 8.6 min, before you ship a bug.
Over budget. Dependencies alone: 69.1 min of downtime a month. Over the 43.2-minute budget by 25.9 min, before you ship a bug.
Over budget. Dependencies alone: 47.5 min of downtime a month. Over the 43.2-minute budget by 4.3 min, before you ship a bug.
Within budget. Dependencies alone: 30.2 min of downtime a month. 13.0 min of the 43.2-minute budget left for your own bugs.
Over budget. Dependencies alone: 51.8 min of downtime a month. Over the 43.2-minute budget by 8.6 min, before you ship a bug.
Within budget. Dependencies alone: 30.2 min of downtime a month. 13.0 min of the 43.2-minute budget left for your own bugs.
Within budget. Dependencies alone: 13.0 min of downtime a month. 30.2 min of the 43.2-minute budget left for your own bugs.
Treynor and his co-authors at Google call this the rule of the extra 9: “A service cannot be more available than the intersection of all its critical dependencies.”4 So “critical dependencies must offer one additional 9 relative to your service.”
When a dependency can’t give you that extra 9, they list three ways out: a capacity cache, failing open, and graceful degradation. They also warn against a tempting misreading. Each nested layer doesn’t need yet another 9. The paper calls that inference “incorrect”.
The same paper has one more number worth carrying into reviews. Three 20-minute outages in a year already rule out 99.99%, which allows about 53 minutes a year. The levers are fewer outages, a smaller scope per outage, and faster recovery.
Do the math on one page
The primer’s worked examples compute average QPS, things like “40 read requests per second on average”.5 They never apply a peak factor, and that’s the step I’d add. Servers fall over at the peak, which for a B2B app is something like 9am on Monday.
Here’s an estimate for an activity feed in a B2B app. Every input is an assumption, including a 5x peak. Measure your own peak-to-average from traffic you already have.
// Activity feed in a B2B app. Every input is an assumption.const dau = 500_000;const readsPerUser = 20;const writesPerUser = 2;const peak = 5; // measure yours: busiest hour vs the daily averageconst followers = 150;const eventBytes = 500;const overhead = 2; // indexes + replicas, rough
const day = 86_400;const readQps = (dau * readsPerUser) / day;const writeQps = (dau * writesPerUser) / day;const fmt = (n: number) => n.toLocaleString("en-US", { maximumFractionDigits: 1 });
console.log("reads/s avg", fmt(readQps), " peak", fmt(readQps * peak));console.log("writes/s avg", fmt(writeQps), " peak", fmt(writeQps * peak));console.log("feed inserts/s at peak", fmt(writeQps * peak * followers));
const eventsGB = (dau * writesPerUser * 365 * eventBytes * overhead) / 1e9;console.log( "GB/yr events", fmt(eventsGB), " fanned out", fmt(eventsGB * followers),);
// Little's law: in flight = arrival rate x time in systemconsole.log("in flight at peak, 300 ms each", fmt(readQps * peak * 0.3));reads/s avg 115.7 peak 578.7writes/s avg 11.6 peak 57.9feed inserts/s at peak 8,680.6GB/yr events 365 fanned out 54,750in flight at peak, 300 ms each 173.6The headline number is small. About 580 reads a second at peak won’t scare anyone in a review.
The dangerous number is the one below it. If each post gets copied into every follower’s feed, 58 writes a second become about 8,700 inserts a second, and 365 GB a year of events becomes about 55 TB of feed rows. The obvious number is rarely the one that bites. Fan-out is. Whether you copy on write or assemble on read is a data-model question, and DDIA part 2 is about exactly that: access patterns pick the store.
The last line is Little’s law: requests in flight equal arrival rate times time in system.6 It tells you how big your connection pools need to be. The 300 ms is the p99, not the average. I used it on purpose, as a ceiling.
Two shortcuts from the primer make this fast. One request per second is about 2.5 million a month, and 400 per second is about a billion.5
Ask what happens when each dependency is slow
Down is the easy case. It’s loud, and someone notices. Slow is the one that takes you out. The SRE book’s chapter on cascading failures defines it as “a failure that grows over time as a result of positive feedback.” The usual causes are overload, resource exhaustion and a dependency that stopped answering.7
Fan-out makes slow worse. Dean and Barroso’s numbers: if a request has to wait on 100 servers, and each one is slow on 1 in 100 requests, then 63% of user requests are slow.8 A rare tail becomes the common case.
So the review gets a table with one row per dependency. Here’s my first pass for the feed:
| Dependency | Slow | Down | Wrong |
|---|---|---|---|
| Postgres | Pools fill, requests queue | No feed, no posting | Stale reads from a replica |
| Cache | Every read goes to Postgres | Same, plus a load spike | Old feed served |
| Auth | Every request waits on it | Nobody gets in, or fail open | Wrong tenant’s feed |
| Fan-out | Feeds lag behind posts | Posts saved, feeds frozen | A post lands twice |
Every cell needs an answer before the design is approved, even if the answer is “we accept this”. Some of them need a mitigation: the cache, failing open, degrading to a shorter feed, shedding load. How long you wait and how often you retry is a whole topic of its own, and it’s part 2.
Operability is a design input
A design that’s cheap to build and expensive to run isn’t cheap. The SRE book’s launch checklist asks questions most design docs skip.9 What happens when a machine dies, a rack fails, or a cluster goes offline? Who is monitoring the monitoring? Are there canaries under live traffic and staged rollouts? What happens at 10x growth? How do you avoid accidentally overrunning third-party services?
I add four of my own:
- How do we roll back? If deploy and release are the same step, rollback is a redeploy under pressure. Deploy is not release.
- How does the schema change? Every schema change should be expand, migrate, contract, and DDIA part 3 covers why old and new code have to read the same rows.
- What pages a human, and how often? If the answer is “we’ll see”, the design isn’t done.
- What do we measure? An SLI nobody records is a guess. Measuring delivery is a good place to start.
Of the three levers in the availability paper, faster recovery is the one that’s most yours. You can’t make your dependencies better, but you can shorten your own MTTR.
The template
Everything above fits on one page. The sections come from Malte Ubl’s write-up of design docs at Google, with SLOs, estimates, failure modes and operability added.10 Every later part in this series links back here.
# <Name>: design
## Context and scope
What exists today, what's changing, and what's out of scope.
## Goals and non-goals
- Goal:- Non-goal:
## SLOs
| SLI | Target | Window || --------------------------- | ------ | ------ || | | || Error budget: 1 - SLO = ... |
## Estimates
Assumptions first (users, reads and writes per user, peak factor, fan-out).
- Peak reads/s, peak writes/s- Storage per year- The number that grows fastest:
## Design
- Diagram (boxes, arrows, and which arrows are synchronous)- API- Data: what's stored where, and how it's read back
## Failure modes
| Dependency | Slow | Down | Wrong || ---------- | ---- | ---- | ----- || | | | |
- What happens if this write runs twice?
## Operability
- Deploy and rollback:- Migrations:- What pages a human, and how often:- Dashboards and SLIs:
## Alternatives considered
What we didn't pick, and why.
## Open questionsUbl puts large design docs at 10 to 20 pages and a mini design doc at 1 to 3. This is the mini one.
When not to bother
Skip the doc when the solution is unambiguous and the doc would only say how to implement it. Ubl’s rule, and a good one. Skip it when you can prototype faster than you can write it, and build a tracer bullet instead.
And don’t set four nines for an internal tool. Every 9 you add costs you a dependency budget you probably can’t afford, and the people using it would rather have the features.
The checklist is a habit
None of this needs a new tool. It’s five moves you make before the boxes and after them, until you make them without the list.
Start with your next design review. Find the dependency table, and if there isn’t one, ask what happens when auth is slow.
Next in the series: timeouts, retries and backoff, or how long to wait for a dependency that isn’t answering.
The next parts aren’t out yet — check back soon.
Footnotes
-
Donne Martin, system-design-primer. The tagline, the four-step method and the availability formulas (in sequence,
A = A1 × A2; in parallel,A = 1 − (1 − A1)(1 − A2)) are all in the README. ↩ ↩2 -
Google, Service Level Objectives, Site Reliability Engineering. The definitions and the target-picking rules are from this chapter. ↩
-
Google, Example Error Budget Policy, The Site Reliability Workbook. ↩
-
Ben Treynor, Mike Dahlin, Vivek Rau and Betsy Beyer, “The Calculus of Service Availability”, ACM Queue, March–April 2017 (PDF). It also defines availability as MTTF / (MTTF + MTTR). ↩
-
The primer’s Pastebin walkthrough. It rounds a month to 2.5 million seconds; 30 days is 2.592 million. ↩ ↩2
-
J. D. C. Little, “A Proof for the Queuing Formula: L = λW”, Operations Research 9(3), 1961. Strictly, W is the mean time in the system. Plugging in the p99 overstates concurrency, which is what you want when sizing a pool. ↩
-
Google, Addressing Cascading Failures, Site Reliability Engineering. ↩
-
Jeffrey Dean and Luiz André Barroso, “The Tail at Scale”, Communications of the ACM 56(2), 2013. With 2,000 servers each slow on 1 in 10,000 requests, the paper puts it at “almost one in five user requests”. ↩
-
Google, Launch Coordination Checklist, Site Reliability Engineering. ↩
-
Malte Ubl, Design Docs at Google (2020). ↩

