Skip to content

Lesson 3 of 9 · 21m

Latency, Percentiles, and Observability That Survives Incidents

How to instrument latency honestly, choose SLIs, and keep telemetry useful when the host is already in trouble.

During an outage nobody complains about your mean latency. They complain that checkout hung for twelve seconds, one request in fifty timed out, and the dashboard looked green. Performance observability is the discipline of measuring the experience users actually had, at a resolution high enough to debug it, without making the incident worse.

Percentiles are the contract

p50 tells you what a typical request feels like; p95 and p99 tell you what unlucky users experience. At modest traffic the tail matters more than intuition suggests: if every page view fans out to twenty service calls, a one-percent tail becomes a routine part of the user experience.

requests_total{route="/checkout",status="200"}
request_duration_seconds_bucket{route="/checkout",le="0.25"}
request_duration_seconds_bucket{route="/checkout",le="0.5"}
request_duration_seconds_bucket{route="/checkout",le="1"}

Histograms beat precomputed percentiles because you can aggregate them across hosts. Percentiles calculated on each machine and then averaged are mathematically meaningless — a common dashboard bug.

Separate saturation from latency

A system can be fast because nobody is using it. Pair every latency SLI with throughput and resource saturation:

Good latency + rising queue depth     = about to fail
Bad latency + falling throughput      = saturated or stalled dependency
Good latency + falling throughput     = traffic vanished, not performance improved

That last case catches people constantly during deploys. If half the fleet stopped receiving traffic, the remaining nodes look fast and your alert stays quiet while users hit errors at the edge.

Instrument the kernel viewpoint too

Application metrics do not explain themselves. Scrape node-level counters so the same dashboard can correlate user latency with CPU steal, disk latency, memory pressure, and network retransmits. On modern systems node_exporter, pressure stall information, and eBPF-based tools cover most of this without hand-rolled collectors.

cat /proc/pressure/cpu
cat /proc/pressure/memory
cat /proc/pressure/io

PSI is especially useful because it measures time tasks were stalled, not just utilization. A box can look "only" 70% busy while every request is waiting behind memory reclaim or disk flush.

Keep telemetry cheap under stress

Metrics collection must degrade gracefully. Bound scrape frequency, label cardinality, and local buffering. High-cardinality labels such as raw user IDs or full URLs can explode memory use inside both the application and Prometheus — exactly when memory is already scarce.

Field notes

  • Never average percentiles across hosts or time windows; aggregate histogram buckets first.
  • A dashboard that only shows application latency invites the wrong fix; include CPU, memory, disk, and network pressure.
  • Log exceptional requests with queue time, upstream time, and runtime context. Twelve seconds somewhere is not twelve seconds everywhere.
  • Test observability during failure drills. Telemetry that dies with the service is merely decoration.

Was this lesson helpful?

Sign in to rate