Skip to content

Lesson 13 of 13 · 11m

USE the Machine Before You Trace the Request

Utilization, saturation, errors first; RED at the service boundary; then the trace's self-time, then the profiler.

The page fires at 02:14: latency on checkout is 8× baseline. The instinct is to open the tracing UI and start reading waterfalls. Don't. A trace answers where this request waited. Your first question is why everything is waiting, and those are different questions with different tools. The order of operations below exists because each step narrows the search space the next one enters.

Step 1: USE the machines

Brendan Gregg's USE method — published in ";login:" in 2012 and enshrined in Systems Performance — is a checklist over resources, not requests. For each resource — CPU, memory, disk, network — check three numbers: Utilization (how busy), Saturation (queued work depth), Errors. vmstat 1, iostat -x 1, sar, or a USE-formatted dashboard walks the whole machine in a couple of minutes.

The point is that resource faults poison every request equally and look, in a trace, like slow application spans. A disk at 100% utilization with an await spike turns storage calls into 300 ms operations; your waterfall shows INSERT spans being slow and you'll file it as a code regression if you never looked at %util. USE finds the resource first. If a resource is saturated, you've found your problem's neighborhood before reading a single span.

Step 2: RED the service

At the service boundary, the SRE-derived trio is RED (Tom Wilkie, Weaveworks): Rate, Errors, Duration — the request-level cousin of the SRE book's four golden signals (latency, traffic, errors, saturation). Compare against baseline: is request rate anomalous (a client retry-looping?), are errors elevated (a dependency down?), or is duration alone spiking (saturation inside)? Duration without errors points at capacity; errors at constant rate point at a dependency; a rate spike with saturating CPU is a thundering herd, not a bug.

Step 3: the trace earns its keep

Now you open a trace — via an exemplar on the p99 datapoint, ideally — and walk root to leaf. The discipline is self-time: a span's duration minus the sum of its children's durations is time spent in that operation itself — queueing, GC pauses, lock waits, or a hop nobody instrumented. A parent at 400 ms with 90 ms of total children has 310 ms of self-time, and that gap is the smoking gun: if the span is a handler, it's waiting on something invisible to tracing. If a hop is missing entirely — the queue consumer whose parent link nobody propagated — self-time tells you the instrumentation has a hole.

Step 4: profile the leaf

When the slow leaf is code, the profiler is the instrument — the continuous profiler you already deployed (Parca, Pyroscope, async-profiler), not something installed during the incident. Diff a flame graph against yesterday's profile; a regression colors itself in a differential view. When the slow leaf is waiting rather than running, on-CPU profiles show nothing and the off-CPU pass — scheduler sleep events, lock stacks — is the axis that shows the block.

Step 5: fix, then verify against the SLI

The burn-rate alert that paged you is the same math that tells you when you're done: the SLI ratio returns to budget, the paired windows stop confirming, and the incident ends on arithmetic rather than vibes.

Practice

  • Keep the order written down: USE → RED → trace → profile → diff. At 02:00 you follow the checklist, not your curiosity.
  • USE dashboards per node and RED per service should exist before the incident.
  • Deploy the profiler fleet-wide so step 4 isn't "install async-profiler on a sick production box."
  • Exemplars turn step 3 from grep into a click.

Every tool answers one question. Ask them in order.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.