Coordinated Omission
Coordinated omission is a measurement error in load testing. A generator that waits for each response before sending the next request slows down when the server slows down. The requests that should have been sent during the slow period are never sent, so their long latencies never enter the data. The server and the generator coordinate, without anyone intending it, to leave out exactly the samples that would show the problem. The effect is documented in the README of wrk2 by Gil Tene, which measures latency from the time each request should have been sent according to a constant-rate schedule rather than from the time it was actually sent.
A traced example
The server takes 5 ms per request, except one request that stalls for one second. The intended load is 100 requests per second, one request every 10 ms. The closed-loop client sends the next request when the previous response arrives, but not earlier than its slot. The open-loop measurement issues requests on schedule and measures from the intended send time. The third row applies a correction after the fact: for each sample longer than the interval, add the samples that the generator would have recorded during the wait, at the sample value minus one interval, minus two intervals, and so on. This is the idea behind the expected-interval option of HdrHistogram. Environment: Python 3.12 on macOS (Darwin 25.6).
import math
RATE, N, SVC, STALL_AT, STALL = 100, 1000, 0.005, 400, 1.0
I = 1 / RATE
sched = [i * I for i in range(N)]
svc = lambda i: STALL if i == STALL_AT else SVC
def pct(xs, p):
s = sorted(xs); return s[min(len(s) - 1, math.ceil(p / 100 * len(s)) - 1)]
# closed loop: next request is sent when the previous response arrives (but not before its slot)
t, sent, closed = 0.0, [], []
for i in range(N):
send = max(t, sched[i]); t = send + svc(i)
sent.append(send); closed.append(t - send)
late = [s - p for s, p in zip(sent, sched)]
print(f"generator diagnostics: {sum(1 for x in late if x > I)} of {N} requests were sent more than one interval late; worst lag {max(late):.3f} s")
# post-hoc correction (HdrHistogram style): a sample longer than the interval implies the requests
# that would have been issued during it; add L-I, L-2I, ... for each such sample
fixed = []
for L in closed:
fixed.append(L)
x = L - I
while x >= I:
fixed.append(x); x -= I
# open loop: requests issued on schedule, latency measured from the intended time
free, opened = 0.0, []
for i in range(N):
start = max(free, sched[i]); free = start + svc(i); opened.append(free - sched[i])
for name, L in (("closed loop, raw", closed), ("closed loop, corrected", fixed), ("open loop", opened)):
print(f"{name:24s} samples {len(L):5d} p50 {pct(L,50)*1000:5.0f} ms p99 {pct(L,99)*1000:5.0f} ms max {max(L)*1000:5.0f} ms over 100 ms: {sum(1 for x in L if x > 0.1)}")
generator diagnostics: 196 of 1000 requests were sent more than one interval late; worst lag 0.990 s
closed loop, raw samples 1000 p50 5 ms p99 5 ms max 1000 ms over 100 ms: 1
closed loop, corrected samples 1098 p50 5 ms p99 900 ms max 1000 ms over 100 ms: 90
open loop samples 1000 p50 5 ms p99 950 ms max 1000 ms over 100 ms: 180
The raw closed-loop result reports a 99th percentile of 5 ms, because only 1 of 1,000 requests saw the stall. The open-loop result reports 950 ms and 180 requests slower than 100 ms, because about 100 requests were due during the stall and the server needed time to work through the backlog afterward. Real users would have experienced those requests.
The generator’s own log is the quickest way to notice the problem. The first output line counts requests sent a full interval or more after their scheduled time. In a correct open-loop test that count should be near zero. If it is large, or if the achieved request rate is below the target while latency is high, the reported tail is optimistic.
Corrections and limits
The cleanest fix is to generate load on a schedule that does not depend on responses and to measure latency from the scheduled send time, as wrk2 does. When only closed-loop data exists, the backfill correction recovers part of the missing tail: here it moves the 99th percentile from 5 ms to 900 ms. It remains an approximation. It assumes each missing request would have waited out the remainder of the stall and does not model the backlog that builds behind it, so it finds 90 requests over 100 ms where the open-loop run has 180.
Closed-loop generators are not wrong in themselves. If the question is how a fixed population of users who each wait for a response and then pause behaves, a closed loop is the right model, and the measured latency is what those users see. The error arises when the result is used to answer a question about a fixed arrival rate, where new requests keep coming regardless of how the server is doing.
References
- wrk2 README, constant-throughput load generation and coordinated omission
- HdrHistogram, corrected and raw value recording
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
