Latency analysis
Percentiles over averages, coordinated omission, tail amplification in fan-out (one slow shard of 100 dominates p99). Little’s law for queue reasoning.
The mental model
If you tell someone "the average wait at this restaurant is 10 minutes," you've told them almost nothing about their evening. Nine tables might be seated in 2 minutes and one party waits an hour — the average is 10, and the one party writes the angry review that sinks the restaurant. Averages describe a number that no single customer actually experiences. What customers experience is their own wait, and what defines the restaurant's reputation is the worst waits, not the typical ones.
Latency analysis is the discipline of reasoning about *distributions*, not averages — because latency is never a single number, it's a distribution with a long, heavy tail, and the tail is where the users live who will leave. The foundational shift is from "what's the average latency?" (a question that hides all the pain) to "what does the p99 look like, and who is in it?" The average is the friend of the complacent: it stays reassuring while a growing fraction of users suffer. Percentiles tell the truth the average conceals.
Three ideas do most of the work in this topic, and an SRE who internalises them reasons about performance in a way that beginners can't:
- Percentiles over averages. p50 (median) is the typical experience; p99 and p99.9 are the tail, where the SLO breaks and users churn. You cannot average percentiles across servers, and the average latency is a vanity metric.
- Tail amplification in fan-out. When a request fans out to many backends and waits for all of them, the slowest one dominates — so a rare per-backend slowness becomes a common per-request slowness. One slow shard of 100 defines your p99.
- **Little's Law.**
L = λ × W— the number of in-flight requests equals arrival rate times latency. It's the algebra that connects load, latency, and concurrency, and it's how you reason about queues without simulating them.
Woven through all three is coordinated omission — the measurement bug that makes almost every naive latency number optimistic about exactly the tail that matters.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision