Understanding and using latency correction for accurate benchmarking.
Traditional benchmarking tools have a fundamental flaw called Coordinated Omission.
Imagine a server that:
Without correction:
With correction:
Use the --latency-correction flag:
burl https://api.example.com --latency-correction
With latency correction enabled, burl:
See the difference correction makes:
#!/bin/bash
echo "Without latency correction:"
burl https://api.example.com -c 100 -d 30s -f json | jq '.latency_ms | {p50, p99}'
echo -e "\nWith latency correction:"
burl https://api.example.com -c 100 -d 30s --latency-correction -f json | jq '.latency_ms | {p50, p99}'
Typical results showing the difference:
Without latency correction:
{
"p50": 45.2,
"p99": 156.8
}
With latency correction:
{
"p50": 48.3,
"p99": 892.4
}
The corrected P99 is much higher because it includes time spent waiting.
Timeline without correction:
Request 1: |--10ms--|
Request 2: |--10ms--|
Request 3: |-------------500ms pause-------------|--10ms--|
Request 4: |--10ms--|
Measured latencies: 10, 10, 10, 10 ms
Reported P99: ~10ms
Timeline with correction:
Request 1: |--10ms--|
Request 2: |--10ms--|
Request 3 (queued): |----wait 300ms----|-------------500ms pause-------------|--10ms--|
Request 4 (queued): |--------wait 500ms--------|-------------500ms pause-------------|--10ms--|
Measured latencies: 10, 10, 810, 1010 ms
Reported P99: ~1000ms
# Production readiness test
burl https://api.production.com \
-c 100 \
-d 5m \
--latency-correction \
--llm json \
-o production_test.json
Document both for complete picture:
# Run both
burl https://api.example.com -c 100 -d 60s -o uncorrected.json
burl https://api.example.com -c 100 -d 60s --latency-correction -o corrected.json
# Compare
echo "Uncorrected P99: $(jq '.latency_ms.p99' uncorrected.json)ms"
echo "Corrected P99: $(jq '.latency_ms.p99' corrected.json)ms"
Latency correction is most meaningful with a target rate:
# Test at specific QPS with accurate latencies
burl https://api.example.com \
-q 1000 \
-c 100 \
-d 60s \
--latency-correction