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.

Beginner 4 min readLesson 3 of 20

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:

MetricMeaning
p50 (median)Half of requests are faster
p9595% are faster; 1 in 20 is slower
p991 in 100 is slower
p99.91 in 1000 is slower

Little's law

For any stable system:

L=λ×WL = \lambda \times W

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

OperationApprox. time
L1 cache reference1 ns
Branch mispredict3 ns
L2 cache reference4 ns
Mutex lock/unlock (uncontended)20 ns
Main memory reference100 ns
Compress 1 KB (fast codec)2 µs
Read 1 MB sequentially from memory10 µs
Round trip within a data centre500 µs
Random read from NVMe SSD20–100 µs
Read 1 MB sequentially from SSD200 µs
Disk seek (HDD)5–10 ms
Round trip US East ↔ West70 ms
Round trip US ↔ Europe80–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.

AvailabilityDowntime per yearPer month
99% ("two nines")3.65 days7.3 hours
99.9%8.8 hours43.8 minutes
99.95%4.4 hours21.9 minutes
99.99%52.6 minutes4.4 minutes
99.999%5.3 minutes26 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

TermDefinitionExample
SLI (indicator)A measured metric of service health% of requests succeeding in under 300 ms
SLO (objective)The internal target for an SLI99.9% over 30 days
SLA (agreement)A contract with customers, with penalties99.5%, or service credits
Error budget1 − SLO: the unreliability you're allowed0.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.
Key takeaways
  • 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.