Architectural Thinking — Forces, Scenarios & Trade-offs›04 · SLOs as design inputs

Lesson 04 of 5 · Targets and decisions

SLOs as design inputs

Treat SLOs as inputs to the architecture, not reports about it. Define SLIs precisely, turn targets into error budgets, compute composite availability across a dependency chain (with a runnable model and real output), see why redundancy only helps when failures are independent, and map each level of availability to the architecture it requires.

Advanced
Key wordsSLISLOSLAerror budgeterror budget policycomposite availabilityhard dependencysoft dependencycorrelated failureburn ratemulti-window alertsstatic stability

Forces

A service-level objective is usually written after the system exists, as a dashboard. That is backwards. The target decides the architecture: 99.9% can be met by one region with good automation; 99.99% leaves about four minutes a month, less than the time it takes a human to read a page and log in. If the target is set after the design, either the target is quietly lowered or the design is quietly rebuilt.

The opposing forces: product wants as many nines as possible, finance pays for each one, and engineering pays in complexity and release speed. An error budget turns that argument into arithmetic.

First principles

SLI, SLO, SLA

  • SLI (indicator): a measured ratio, good events / valid events, over a window. "Valid" matters: exclude requests that were rejected for being malformed, and decide whether to count client-cancelled requests.
  • SLO (objective): a target for the SLI over a window, for example 99.9% of valid requests succeed in under 300 ms over 30 days.
  • SLA (agreement): a contract with consequences, usually credits. Set it looser than the SLO, so you see and fix trouble before you owe money.

Measure as close to the user as you can. An SLI computed from the application's own metrics misses failures in the load balancer, DNS and TLS in front of it.

Common SLI types:

Type Definition (good / valid) Measured at
Availability Requests not answered with 5xx or timeout Edge load balancer logs, synthetic probes
Latency Requests completed under a threshold Edge, per endpoint class
Freshness Reads that return data younger than N seconds The reader, or a probe that writes and reads
Correctness Outputs that match an independent check Reconciliation job
Durability Objects readable after N days Restore tests

Error budgets

The budget is 1 − SLO of the window. Over 30 days:

SLO        bad minutes / 30 days
99.0000%      432.0
99.5000%      216.0
99.9000%       43.2
99.9500%       21.6
99.9900%        4.3

An error budget policy says what happens when it is spent: for example, feature releases stop and the team works on reliability until the budget recovers. The policy is what gives the number teeth. Without it, the SLO is a decoration.

Composite availability

When a request needs every component in a chain (a hard dependency), the availabilities multiply. Six dependencies at three to four nines each give an end-to-end figure well below any one of them. When a component can fail without failing the request (a soft dependency: the request falls back, degrades or skips), it leaves the product.

Redundancy works the other way: two independent copies, each up a fraction a of the time, are both down only (1 − a)² of the time. The word that matters is independent. If some failures hit both copies at once (same zone, same config push, same software bug), the shared part does not square away.

edge/WAF 99.99% gateway 99.95% auth 99.95% app 99.9% database 99.95% cache 99.9% SERIAL: A REQUEST NEEDS ALL OF THEM 0.9999 × 0.9995 × 0.9995 × 0.999 × 0.9995 × 0.999 = 99.64% ≈ 155 bad min / 30 days make the cache soft (fall back to the database): 99.74% ≈ 112 min Shared failure domain: same zone, same config push replica A 99.9% replica B 99.9% independent copies: 99.9999% 30% of failures shared: 99.97% the shared part dominates
Hard dependencies multiply. Redundancy squares unavailability only for the failures the copies don't share.

From target to architecture

A rough but useful map. Monthly downtime allowance in brackets:

Target What it typically requires
99% (7.2 h) Single instance with restart and backups; manual recovery is acceptable
99.9% (43 min) Multiple instances across zones, automated failover for stateful parts, safe deploys with fast rollback
99.95% (22 min) The above plus no single-zone dependencies, canary releases, tested restore, on-call with fast response
99.99% (4.3 min) No human in the recovery path for common failures; independent failure domains (cells or regions); static stability; dependencies held to tighter SLOs or made soft
99.999% (26 s) Multi-region active-active with automated traffic shifting, every dependency engineered to the same level; rarely worth it outside a few domains

The 99.99% row is the important boundary. Below it, people can fix things. Above it, the architecture has to fix itself.

Static stability

A system is statically stable if it keeps working when the thing that changes it is broken. The data plane serves traffic with the configuration it already has when the control plane is down; capacity for a zone failure is provisioned in advance rather than launched during the failure, because the launch API may be what failed. AWS's Builders' Library describes this as a core design principle for its own services.

Design space

Lever Effect on the SLO Cost
Make a dependency soft (fallback, cache, default) Removes it from the product Degraded behaviour to design and test
Add independent redundancy Squares unavailability, if failures are independent Capacity, and keeping copies truly independent
Shrink blast radius (cells, sharding) Fewer users affected per failure; per-user availability improves Routing layer, operational surface
Tighten the dependency's SLO Raises the product The dependency team's budget and roadmap
Static stability (pre-provisioned capacity, cached config) Survives control-plane failures Idle capacity, staleness of config
Faster detection and rollback Shorter incidents eat less budget Investment in canaries and automation

Failure modes

  • Measuring the wrong place. The SLI is green while users see errors from the edge.
  • SLOs for every metric. A target on CPU or queue depth is an alert threshold, not an objective. SLOs describe what users experience.
  • Assuming independence. Two replicas in one zone, or one global config pipeline feeding every region, give much less than the multiplication suggests.
  • No error budget policy. The budget is spent every month and nothing changes.
  • Alerting on every error. Page on budget burn rate instead: the Google SRE Workbook's multi-window approach pages when, for example, 2% of a 30-day budget burns in one hour (a burn rate of 14.4) and opens a ticket for slower burns.

Published incident: AWS us-east-1, 7 December 2021

An automated scaling action in AWS's internal network in the us-east-1 region triggered a surge of connection activity that congested the devices between the internal network and the main AWS network. Customer workloads running in the region largely kept working, but many control-plane and monitoring APIs that depended on the internal network did not, and the congestion also impaired AWS's own monitoring, which slowed diagnosis. Services across the industry that were deployed across multiple availability zones were still affected, because they depended on regional control-plane operations (launching instances, reading configuration, authenticating) during the event. Lesson: multi-AZ data planes don't help if recovery depends on a control plane that shares the failure. Static stability and pre-provisioned capacity are what keep the data plane up.

Lab: composite availability model

Save as availability.py and run with Python 3. Then change the chain to match a real system you know.

#!/usr/bin/env python3
"""Composite availability and error budgets. Change the chain, rerun."""
MIN_30D = 30 * 24 * 60

def budget(slo):            # allowed bad minutes in 30 days
    return (1 - slo) * MIN_30D

print("SLO        bad minutes / 30 days")
for slo in (0.99, 0.995, 0.999, 0.9995, 0.9999):
    print(f"{slo:<9.4%}  {budget(slo):8.1f}")

# a request needs every dependency in the chain (serial): A = product
chain = {"edge/WAF": 0.9999, "API gateway": 0.9995, "auth service": 0.9995,
         "app service": 0.999, "database": 0.9995, "cache": 0.999}
a = 1.0
for v in chain.values():
    a *= v
print(f"\nserial chain of {len(chain)} hard dependencies: {a:.4%}  ({budget(a):.0f} bad min / 30 d)")

# make the cache a soft dependency (fall back to the database): it leaves the chain
soft = {k: v for k, v in chain.items() if k != "cache"}
b = 1.0
for v in soft.values():
    b *= v
print(f"cache made soft (fallback):            {b:.4%}  ({budget(b):.0f} bad min / 30 d)")

# two independent replicas in parallel: A = 1 - (1-a)^2
for single in (0.99, 0.995, 0.999):
    print(f"two independent copies of {single:.1%}:    {1-(1-single)**2:.4%}")

# the catch: correlated failure. A share c of each copy's failures hits both at once
single, c = 0.999, 0.30
u = 1 - single
pair_down = c * u + ((1 - c) * u) ** 2      # shared-cause outages + independent overlap
print(f"\n{single:.1%} pair, {c:.0%} of failures shared (same zone, same deploy): about {1 - pair_down:.4%}")

Output from a real run (Python 3, macOS):

SLO        bad minutes / 30 days
99.0000%      432.0
99.5000%      216.0
99.9000%       43.2
99.9500%       21.6
99.9900%        4.3

serial chain of 6 hard dependencies: 99.6405%  (155 bad min / 30 d)
cache made soft (fallback):            99.7402%  (112 bad min / 30 d)
two independent copies of 99.0%:    99.9900%
two independent copies of 99.5%:    99.9975%
two independent copies of 99.9%:    99.9999%

99.9% pair, 30% of failures shared (same zone, same deploy): about 99.9700%

What to read from it:

  • Six hard dependencies, none worse than 99.9%, give 99.64%: about 155 minutes of failure a month. No component is "the problem"; the chain is.
  • Turning the cache into a soft dependency (fall back to the database, accept higher latency) removes 43 minutes a month for the cost of a fallback path and capacity on the database to absorb it.
  • Two independent 99.9% copies give 99.9999% in theory. If 30% of failures are shared, the pair gives about 99.97%: the shared fraction dominates. Independence is the expensive part of redundancy.

Exercises:

  1. Your product SLO is 99.95%. Which dependencies must become soft, or be tightened, to get there? Show the arithmetic.
  2. Set the shared-failure fraction to 10% and 50%. How does the pair's availability move? What design choices change that fraction in practice?
  3. Model a cell architecture: each cell is 99.95%, and a failure affects only that cell's 5% of tenants. What availability does an individual tenant see, and what does the "whole product" figure mean now?

Architect's lens

From the ten questions, SLOs turn failure and operate into numbers, and drive cost. In every design: state the SLO and where its SLI is measured; list hard and soft dependencies and the composite figure; name the shared failure domains; say which failures are recovered without a human.

Design review

Brief. An authorisation decision API answers "may user U perform action A on resource R?" for every request of 30 product services. Product wants 99.99% availability and p99 under 10 ms. It depends on a policy store, a grants database, an identity provider for group membership, and a configuration service. All run in one region today, across three zones.

Produce: SLIs and SLOs with measurement points; the dependency chain with hard and soft dependencies and the composite figure; the changes needed to reach the target (caching, local evaluation, static stability); the error budget policy; and the burn-rate alerts.

Level What the answer shows
Senior Correct composite maths; caching proposed
Staff Decision path made statically stable (local policy evaluation with cached data); the staleness trade-off against revocation stated; burn-rate alerts
Principal The fail-open versus fail-closed decision made explicitly per action class, with security sign-off; callers' own fallback behaviour specified; whether 99.99% is the right target at all, and what it costs

Self-check

Why should the SLA be looser than the SLO?

So you see SLO breaches, and act on them, before they cost contractual credits. The gap is the safety margin.

Two replicas in the same zone, each 99.9%. Why is the pair far below 99.9999%?

Zone failures, shared networking and shared deploys take both down together. Only independent failures multiply away.

What makes 99.99% a different kind of target from 99.9%?

About 4 minutes a month is less than human response time, so recovery from common failures must be automatic, and failure domains must be independent.

References

  • Beyer et al., Site Reliability Engineering (Google, 2016), chapters 3-4
  • Beyer et al., The Site Reliability Workbook (Google, 2018), chapters 2 and 5 (SLO implementation, alerting on SLOs)
  • AWS, "Summary of the AWS Service Event in the Northern Virginia (US-EAST-1) Region", December 2021
  • AWS Builders' Library, "Static stability using Availability Zones"
  • Treynor et al., "The Calculus of Service Availability", ACM Queue, 2017

This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.