SLAs, SLOs, and Percentile Latency
How to state, measure and defend latency targets with percentiles instead of averages, why fan-out makes the slow tail worse, and the techniques that shorten it.
Overview
Users do not feel your average response time. They feel their own request, and the slow ones are what they remember. So a serious latency target is written as a percentile: '99% of requests finish within 200 ms', not 'the average is 30 ms'.
This topic covers the vocabulary (SLI, SLO, SLA), why averages mislead, why the slow tail gets worse as one request fans out to many servers, how to measure percentiles correctly, and the main ways to shorten the tail.
SLI, SLO and SLA
Three terms from Google's SRE practice are now standard. An SLI (service level indicator) is a measurement. An SLO (service level objective) is a target for that measurement. An SLA (service level agreement) is a promise to users that comes with consequences if the SLO is missed, such as service credits. A fourth term, the error budget, is how much the SLO lets you miss.
One example of each makes the difference concrete.
- SLI: a measured number, such as the p99 latency of checkout requests over 5 minutes.
- SLO: a target for the SLI, such as p99 under 300 ms, measured over 28 days.
- SLA: a contract with consequences. An illustrative contract: below 99.9% success in a month earns a service credit.
- Error budget: a 99.9% SLO allows 0.1% of requests to fail or be slow.
Set the internal SLO tighter than the SLA. The gap gives the team time to fix a problem before it costs money. The error budget turns reliability into a shared decision: while budget is left, teams can ship quickly; when it is spent, releases slow down and the work shifts to stability.
Key concepts
- SLI
- SLO
- SLA
- Error budget
- Percentile
- Tail latency
- Tail amplification
- Head-of-line blocking
- Hedged request
Interview questions
- Why use p99 latency instead of the average for an SLO?
- A page calls 50 backends in parallel, each slow 1% of the time. How often is the page slow, and what do you do?
- How do you measure p99 latency across a fleet of 200 servers?
- What is the difference between an SLO and an SLA, and how should they relate?
Sign up free to read the full topic
More DDIA topics
- Replication Lag and Consistency Anomalies
- Schema Evolution and Backward/Forward Compatibility
- Schema-on-Read vs Schema-on-Write
- Secondary Indexes and Index Trade-offs
- Secondary Indexes on Partitioned Data
- Single-Leader Replication
- Unbundling the Database
- What Is a Data-Intensive Application?
- Write Skew and Phantom Reads
- ZooKeeper, etcd, and Distributed Coordination
Start free on Cariara · Coding problems · System design studio