Skip to main content
← PROBLEMS / PRODUCTION-DEBUGGING
An end-to-end domain learning journey

Fixing Coordinated Omission
in Load Tests.

Closed-loop load generators pause sending while waiting for slow responses, hiding 800 ms JVM safepoint stalls (reporting 45 ms p99.9 instead of 2,400 ms); an open-loop pacer with HdrHistogram expected-interval backfill captures true queueing delay.
Start the journey5 stages
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

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.

Full walkthrough · 5 stages
01
STAGE 01 · WHY IT MATTERSL4 · FUNDAMENTALS

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.

02
STAGE 02 · IMPACTL5 · APPLIED DESIGN

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:

  1. Zero Queueing Visibility: Measuring only actual_send -> response ignores the time requests wait in the arrival queue during a pause.
  2. False SLA Confidence: Only 100 in-flight requests record the 800 ms stall instead of 4,000 arrivals, making p99.9 look artificially clean.
Closed-Loop vs. Open-Loop Pacer

800ms Server Stall: Closed-Loop Hides Queueing vs. Open-Loop Measures It

Open-Loop PacerAsync Client (2k)Payment GW1. Schedule every 200us (5,000RPS)2. 800ms JVM safepoint pause!3. 4,000 virtual arrivals queue up4. Record (now - intended_start) +backfill

Recording response_time = now - intended_start_ns captures the full queueing + service delay during stalls.

Engineering Decision Framework
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.
Decision Exercise · Make the Call

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?

03
STAGE 03 · NAIVE SOLUTIONL5 · APPLIED DESIGN

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.

Lifecycle & Failure Recovery

Naive solution (and why adding more closed-loop threads doesn't fix it)

admitsucceedbudget exceededInitializedProcessingInvariant MetDegraded Fallback
04
STAGE 04 · ENTERPRISE SOLUTIONL6 · SCALE & TRADE-OFFS

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 µs intervals (5,000 RPS) using System.nanoTime() (monotonic, immune to NTP).
  • Service vs. Response Time: Track both service_time = end - actual_send and response_time = end - intended_start.
  • HdrHistogram Backfill: Call recordValueWithExpectedInterval(latencyNs, expectedIntervalNs) (which linearly backfills latency - k * interval for omitted samples) inside bounded memory (< 512 MB heap) for 10M+ samples.
  • Bounded Socket Pool: Cap physical sockets at 2,048 while accounting for queued virtual arrivals.
Low-Overhead Open-Loop Harness

NanoTime Pacer -> Bounded Async Pool -> HdrHistogram Dual Recording

NanoTime PacerFixed 200us ticksVirtual QueueTracks intended_tsAsync HTTP Pool<=2,048 socketsHdrHistogramUncorrected + CO

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);
    });
}
05
STAGE 05 · SYSTEM DESIGN APPLICATIONSL7 · STAFF / PRINCIPAL

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 ms p99.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 · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

Why does a closed-loop benchmark under-report p99.9 latency during an 800 ms server GC pause?

Recommended Learning Flow