In this lesson · topic 5 of 7
Topic 5
Your SLO cannot beat your dependencies
7 min read
An SLO feels like a promise about your own code. A request that needs a database, an auth service and a payment provider also needs all three to answer, and your target has to live with that.
Hard dependencies multiply
If a request succeeds only when every dependency succeeds, the availabilities multiply. Suppose your service targets 99.9 percent and calls three hard dependencies, each of which delivers 99.95 percent. Even if your own code never fails, the best you can do is
0.9995 × 0.9995 × 0.9995 = 0.9985
That is 99.85 percent. Over 30 days, 0.15 percent of 43,200 minutes is 64.8 minutes of expected failure, against a budget of 43.2 minutes for 99.9 percent. The target was already broken before you wrote a line of code.
The multiplication assumes independent failures. When dependencies fail together, because they share a data center or a deploy pipeline, the combined result is somewhat better than the product. That makes the product a useful pessimistic estimate, not a promise.
Predict first
Making the arithmetic work
You have four levers.
Better dependencies. If each of the three were at 99.99 percent, the product is 99.97 percent. Dependencies then use 13 minutes of your 43.2-minute budget, which leaves 30 for your own bugs and releases. A common rule of thumb is that dependencies should be about an order of magnitude more reliable than the service built on them, so that they take only a small slice of the budget.
Soft dependencies. Not every call has to succeed for a request to succeed. A recommendations service that falls back to a default list is a soft dependency, and its failures are not your failures. A dependency used on 20 percent of requests, at 99.9 percent, costs 0.2 times 0.1 percent, or 0.02 percent, a fifth of the hit.
Caching and fallbacks. Serving a stale value when the source is down turns a dependency failure into a degraded success. The price is stale data, so decide which answers may be stale and for how long.
Redundancy. Two independent replicas at 99.9 percent would give 99.9999 percent, in theory. In practice replicas in one region share networks, configs and bad deploys, so count on one extra nine, not three.
Spending the budget on purpose
Treat the dependency losses as a line in the budget instead of a surprise. For a 99.9 percent target with 43.2 minutes, a worked split might be:
| Spend | Minutes |
|---|---|
| Hard dependencies (measured) | 13 |
| Planned maintenance and releases | 15 |
| Own bugs and incidents | 15 |
| Unallocated | 0.2 |
The numbers are an example, not a recipe. The point is the exercise: the sum has to fit, and when it does not, the target or the dependency list has to change. Use each dependency’s measured history rather than its published target, because a dependency often runs well above its promise, and sometimes below it.
Sources
- Ben Treynor, Benjamin Lutch, Betsy Beyer, Mike Dahlin and Vivek Rau, The Calculus of Service Availability, ACM Queue, 2017.
- Betsy Beyer, Niall Richard Murphy, David K. Rensin, Kent Kawahara and Stephen Thorne (eds.), The Site Reliability Workbook, chapter “Implementing SLOs”, O’Reilly, 2018.