If latency budgets leave no room for synchronous retries, always benchmark latency SLAs with an open-loop fixed-rate scheduler that measures from intended scheduled start time and backfills omitted intervals during server stalls.
TL;DR30-second simplified summary▾
Core Mechanics: A closed-loop benchmark with 100 worker threads reports p99.9 = 45 ms at 5,000 RPS, yet production alerts fire on 2.4-second timeouts during 800 ms JVM safepoint pauses.
Visual & Structural Flow: Depicts 800ms Server Stall: Closed-Loop Hides Queueing vs. Open-Loop Measures It (Open-Loop Pacer -> Async Client (2k) -> Payment GW); NanoTime Pacer -> Bounded Async Pool -> HdrHistogram Dual Recording (NanoTime Pacer -> Virtual Queue -> Async HTTP Pool -> HdrHistogram).
Trade-Offs & Production: Increasing closed-loop threads from 100 to 2,000 still stalls once all threads are waiting on a long GC pause, and exhausts client-side ephemeral ports or CPU. Accurate tail-latency benchmarking (wrk2, k6 constant-arrival-rate, HdrHistogram) uses four rules: Open-Loop Arrival Schedule: Schedule requests at fixed 200 µs.
Failure Modes & Application: Coordinated-omission-free testing is mandatory before signing off on strict p99.9 SLAs: Payment & Trading Gateways: Validating < 120 ms p99.9 under realistic JVM/Go GC pauses.
Why Coordinated Omission invalidates closed-loop benchmarks.
Why this matters: The mechanism: understand how Why Coordinated Omission invalidates closed-loop benchmarks works from first principles.
Think of Why Coordinated Omission invalidates closed-loop benchmarks as the intuition layer for Fixing Coordinated Omission in Load Tests: The mechanism: understand how Why Coordinated Omission invalidates closed-loop benchmarks works from first principles.
A closed-loop benchmark with 100 worker threads reports p99.9 = 45 ms at 5,000 RPS, yet production alerts fire on 2.4-second timeouts during 800 ms JVM safepoint pauses. Because each closed-loop thread waits for a response before sending its next request, all 100 threads stop sending during the 800 ms pause—omitting the 4,000 requests that would have arrived at 5,000 RPS and queued behind the stall.
What happens when load generators coordinate with server stalls.
Why this matters: The problem: see what breaks without What happens when load generators coordinate with server stalls under real concurrency or scale.
Coordinated Omission distorts tail percentiles in two ways:
- Zero Queueing Visibility: Measuring only
actual_send -> responseignores the time requests wait in the arrival queue during a pause. - False SLA Confidence: Only
100in-flight requests record the800 msstall instead of4,000arrivals, makingp99.9look artificially clean.
800ms Server Stall: Closed-Loop Hides Queueing vs. Open-Loop Measures It
Recording response_time = now - intended_start_ns captures the full queueing + service delay during stalls.
- Problem
- How to implement Fixing Coordinated Omission in Load Tests without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- If latency budgets leave no room for synchronous retries, always benchmark latency SLAs with an open-loop fixed-rate scheduler that measures from intended scheduled start time and backfills omitted intervals during server stalls.
- Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Fixing Coordinated Omission in Load Tests experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Naive solution (and why adding more closed-loop threads doesn't fix it).
Why this matters: The problem: see what breaks without Naive solution under real concurrency or scale.
Think of Naive solution (and why adding more closed-loop threads doesn't fix it) as the intuition layer for Fixing Coordinated Omission in Load Tests: The problem: see what breaks without Naive solution under real concurrency or scale.
Increasing closed-loop threads from 100 to 2,000 still stalls once all threads are waiting on a long GC pause, and exhausts client-side ephemeral ports or CPU.
Naive solution (and why adding more closed-loop threads doesn't fix it)
Enterprise solution: Open-Loop Pacer + HdrHistogram Backfill + Monotonic Clock.
Why this matters: Operational control: configure bounds, failure handling, and safe production defaults.
Accurate tail-latency benchmarking (wrk2, k6 constant-arrival-rate, HdrHistogram) uses four rules:
- Open-Loop Arrival Schedule: Schedule requests at fixed
200 µsintervals (5,000 RPS) usingSystem.nanoTime()(monotonic, immune to NTP). - Service vs. Response Time: Track both
service_time = end - actual_sendandresponse_time = end - intended_start. - HdrHistogram Backfill: Call
recordValueWithExpectedInterval(latencyNs, expectedIntervalNs)(which linearly backfillslatency - k * intervalfor omitted samples) inside bounded memory (< 512 MBheap) for10M+samples. - Bounded Socket Pool: Cap physical sockets at
2,048while accounting for queued virtual arrivals.
NanoTime Pacer -> Bounded Async Pool -> HdrHistogram Dual Recording
1.Monotonic Clock: System.nanoTime() avoids wall-clock NTP jumps.
2.Dual Metrics: Emits both service-time and CO-corrected response-time percentiles.
3.Constant Memory: HdrHistogram tracks 10M+ samples in < 10 MB RAM with zero GC pressure.
4.Socket Cap: 2,048 async keep-alive sockets prevent client EADDRNOTAVAIL.
Open-loop pacing with HdrHistogram backfill exposes the true 2.4s p99.9 tail latency from a single < 5% CPU generator.
// Open-loop pacer + HdrHistogram Coordinated Omission correction
final long intervalNs = 1_000_000_000L / 5_000; // 200,000 ns = 5,000 RPS
long intendedStartNs = System.nanoTime();
while (running) {
long now = System.nanoTime();
if (now < intendedStartNs) {
LockSupport.parkNanos(intendedStartNs - now);
continue;
}
final long scheduledNs = intendedStartNs;
intendedStartNs += intervalNs;
asyncClient.sendAsync(req).whenComplete((resp, err) -> {
long responseTimeNs = System.nanoTime() - scheduledNs;
correctedHist.recordValueWithExpectedInterval(responseTimeNs, intervalNs);
});
}
Where Open-Loop Benchmarking applies in System Design.
Why this matters: Scope boundary: identify where this pattern fits best and where simpler or async alternatives win.
Coordinated-omission-free testing is mandatory before signing off on strict p99.9 SLAs:
- Payment & Trading Gateways: Validating
< 120 msp99.9 under realistic JVM/Go GC pauses. - API Gateway & Load Balancer Tuning: Verifying queue-drop and backpressure behavior during bursts.
- Database & Cache Benchmarks: Measuring true tail latency under checkpointing or compaction stalls.
Practice: Make the trade-off yourself.
Why does a closed-loop benchmark under-report p99.9 latency during an 800 ms server GC pause?