HAMZA KAREEM / CONCEPTS hamzawi.dev

Lesson 1172 min read

Coordinated Omission

Why Your Load Test Says p99=12ms and Prod Says 1.9s

System designsystem design / performance testing

The symptom

Load test: 200 threads, each loops { send; await reply; repeat }. Report:

p50 = 8ms   p99 = 12ms   max = 31ms

Same traffic in prod: p99 = 1.9s, users complaining. Not 20% off — 150x off. Where did the latency go?

Step 1 — reread the loop

for (;;) {
  t0 = now();
  send(); await reply();
  record(now() - t0);
}

Every sample is a real, honestly timed request. The clock isn't lying.

Step 2 — ask what happens during a stall

Server hiccups for 1s (GC pause, lock convoy, failover). All 200 threads are parked in await.

During that second they issue ZERO new requests.

When it clears, each thread records exactly ONE ~1000ms sample, then goes back to 8ms.

Step 3 — count the missing samples

200 threads at 8ms each = 25,000 req/s intended.

In that 1s stall you should have sent ~25,000 requests. You sent 200.

≈24,800 requests that would have been slow were never sent — so never measured.

The concept

Coordinated omission: your load generator's send rate is coordinated with the server's response time. When the server slows, the client politely slows too, and the bad samples are omitted from the histogram.

Do the percentile math: a 10s test at 25k/s ≈ 250,000 samples. The outage contributed 200 of them = 0.08%. The p99 cutoff needs the worst 1%.

The outage was mathematically incapable of reaching p99. Your tool reported a true number about a fake workload.

The fixes

1️⃣ Use an open-loop (constant-arrival-rate) generator — send on a schedule, not after the reply: wrk2, vegeta attack -rate=500/s, k6 constant-arrival-rate, Gatling. If replies lag, requests pile up instead of throttling.

2️⃣ Measure from intended start, not actual send:

latency = replyTime − scheduledSendTime
That's HdrHistogram's recordValueWithExpectedInterval() — it back-fills the samples you couldn't take.

3️⃣ Treat "requests/s achieved" from a closed-loop tool (ab, JMeter thread groups) as a result, not a setting. If throughput drops when latency rises, you measured the client.

Same bug, other costumes

  • Server-side histograms behind a queue or retry layer: you only time what got in the door. Add queue wait time or you'll never see it.
  • APM timers that start when a worker thread picks up the request — accept-to-dequeue time vanishes.
  • A "p99 looks fine" dashboard during a known incident is usually this, not luck.

Your exercise

Run two 30s tests at the same target rate against any local service: one closed-loop (ab -c 50), one open-loop (vegeta attack -rate=500/s -duration=30s).

Midway through each, freeze the server for 2s:

kill -STOP <pid>; sleep 2; kill -CONT <pid>

Compare p99 and max between the two runs. Which tool noticed the freeze — and by how much?