Latency, Throughput & Availability
Latency vs throughput, percentiles and tail latency, Little's law, availability nines and SLIs/SLOs/SLAs, and the latency numbers every engineer should know.
To design systems you need a precise vocabulary for "fast" and "reliable". Vague goals ("it should be quick") lead to vague designs.
Latency vs throughput
- Latency — how long one request takes (ms).
- Throughput — how many requests are completed per unit of time (requests/s, MB/s).
They interact: as utilisation approaches 100%, queues form and latency explodes. Running a server at 95% CPU maximises throughput on paper but makes latency terrible.
Percentiles, not averages
Averages hide the experience of your unluckiest users. Measure percentiles:
| Metric | Meaning |
|---|---|
| p50 (median) | Half of requests are faster |
| p95 | 95% are faster; 1 in 20 is slower |
| p99 | 1 in 100 is slower |
| p99.9 | 1 in 1000 is slower |
Little's law
For any stable system:
L = average number of requests in the system (concurrency), λ = arrival rate (throughput), W = average time in the system (latency).
Example: 2,000 requests/s with 50 ms latency means 2000 × 0.05 = 100 requests in flight on average. If each server handles 20 concurrent requests, you need at least 5 servers (plus headroom). If latency rises to 500 ms (a slow database), concurrency jumps to 1,000 and threads or connections run out — which is how a slow dependency takes down a healthy service.
Latency numbers every engineer should know
| Operation | Approx. time |
|---|---|
| L1 cache reference | 1 ns |
| Branch mispredict | 3 ns |
| L2 cache reference | 4 ns |
| Mutex lock/unlock (uncontended) | 20 ns |
| Main memory reference | 100 ns |
| Compress 1 KB (fast codec) | 2 µs |
| Read 1 MB sequentially from memory | 10 µs |
| Round trip within a data centre | 500 µs |
| Random read from NVMe SSD | 20–100 µs |
| Read 1 MB sequentially from SSD | 200 µs |
| Disk seek (HDD) | 5–10 ms |
| Round trip US East ↔ West | 70 ms |
| Round trip US ↔ Europe | 80–150 ms |
Takeaways: memory is ~1000× faster than network calls; avoid round trips; cross-region calls are expensive; sequential I/O beats random.
Availability
Availability = fraction of time the system works correctly.
| Availability | Downtime per year | Per month |
|---|---|---|
| 99% ("two nines") | 3.65 days | 7.3 hours |
| 99.9% | 8.8 hours | 43.8 minutes |
| 99.95% | 4.4 hours | 21.9 minutes |
| 99.99% | 52.6 minutes | 4.4 minutes |
| 99.999% | 5.3 minutes | 26 seconds |
Composing availability
- Components in series (all must work): multiply. Three dependencies at 99.9% → 0.999³ ≈ 99.7%.
- Components in parallel (any one suffices): 1 − (1 − a)ⁿ. Two independent replicas at 99% → 1 − 0.01² = 99.99%.
Every hard dependency lowers your availability; redundancy raises it — if failures really are independent.
SLIs, SLOs and SLAs
| Term | Definition | Example |
|---|---|---|
| SLI (indicator) | A measured metric of service health | % of requests succeeding in under 300 ms |
| SLO (objective) | The internal target for an SLI | 99.9% over 30 days |
| SLA (agreement) | A contract with customers, with penalties | 99.5%, or service credits |
| Error budget | 1 − SLO: the unreliability you're allowed | 0.1% ≈ 43 minutes a month |
Teams spend the error budget on risky launches; when it's exhausted, they focus on reliability. See Monitoring & SRE.
Ways to reduce latency
- Avoid work: caching, precomputation, smaller payloads.
- Avoid round trips: batch requests, keep connections open, co-locate services and data, use CDNs.
- Parallelise independent calls.
- Go asynchronous: return early and finish the work in the background.
- Trim the tail: timeouts, hedging, load shedding.
- Latency = time per request; throughput = requests per time; high utilisation inflates latency.
- Use percentiles (p95, p99), not averages; fan-out amplifies tail latency.
- Little's law: concurrency = throughput × latency.
- Know the latency numbers: memory ≪ SSD ≪ network ≪ cross-region.
- Availability multiplies across dependencies; SLOs and error budgets make reliability measurable.