advanced28 min studyLesson 720 in Engineering

Replay offered arrivals without hiding overload

Preserve arrival timing, length correlations, client dispatch delays, warm-up state, and incomplete outcomes while measuring latency without coordinated omission.

On this page

What you’ll understand

  • Distinguish open-loop offered arrivals from completion-gated closed-loop load.
  • Calculate planned-start and actual-send latency as different diagnostic intervals.
  • Design repeatable trace comparisons with drain, failure, and percentile conventions.

A scheduler benchmark is an experiment on an arrival process, not just a list of prompts. If a client waits for each response before sending the next request, the server's slowdown can reduce offered traffic precisely when an independent-arrival workload would be building a queue. That can hide overload and distort latency comparisons. Preserve the intended arrival plan and the actual dispatch record, then report the timing boundary relevant to the service claim instead of silently treating every completed sample as representative.

Replay the joint workload rather than isolated averages

Retain interarrival times, prompt and output-length relationships, tenant identity, burst structure, deadlines, and cancellation or stop policies when those are relevant to the experiment. Shuffling lengths independently of arrivals can remove a difficult burst of long prompts while leaving each marginal histogram unchanged. If output generation is stochastic, distinguish a fixed-work replay from a realistic decode-policy experiment; forcing output lengths can change semantics but may be useful for a declared scheduler fixture. Record which kind of comparison is being made.

Also state initial conditions: loaded model and tokenizer, serving version, cache residency, prefix-hit policy, allocator state, warm-up, and number of outstanding clients. An arrival-rate sweep is useful, but a Poisson process is one workload choice rather than a universal description of users. Repeat with controlled seeds or preserved traces and inspect run-to-run variation. A single p99 from a small cohort is not a population guarantee, and a model's queueing mean is not a measured tail percentile.

ai=t0+∑j=1iΔja_i=t_0+\sum_{j=1}^{i}\Delta_j
a_i is intended arrival time for request i, with nonnegative interarrival intervals Δ_j in one time unit. Replaying the same intervals preserves that timing plan only if client dispatch capacity and the chosen outstanding-request policy permit it. A delayed or dropped dispatch must be recorded.↔ Scroll wide equations horizontally.

Prevent coordinated omission from changing the question

A closed-loop client is valid when the intended question concerns a fixed number of users waiting for responses before making new requests. It is not equivalent to independent offered arrivals at a fixed rate. When responses slow, completion-gated clients submit fewer new requests, coordinating away some work that an open-loop plan would have offered. The wrk2 author's primary documentation explains this measurement problem and its planned-start accounting approach. A benchmark must choose its workload rather than silently accept the load generator's accidental behavior.

Record planned arrival, actual send, first token, and terminal time separately. Planned-start latency includes load-generator dispatch delay; actual-send latency excludes that delay. Both can be useful, but do not label the former purely server execution time. If the generator falls behind, increase its capacity or report missed dispatches and delay instead of pretending it maintained the target rate. A correction formula cannot reconstruct every interaction that would have occurred under a different actual arrival process.

Liplan=ei−ai,Lisend=ei−si,Liplan−Lisend=si−aiL_i^{\rm plan}=e_i-a_i,\qquad L_i^{\rm send}=e_i-s_i,\qquad L_i^{\rm plan}-L_i^{\rm send}=s_i-a_i
a_i is intended arrival, s_i actual send, and e_i terminal observation on a consistent clock. The difference is client dispatch delay when s_i≥a_i. This identity distinguishes measurement boundaries; it does not infer an unobserved server queue or recreate a different workload.↔ Scroll wide equations horizontally.

Keep unfinished requests and reporting rules visible

Define the offered cohort, warm-up exclusion, timeout, drain period, outcome categories, and percentile estimator before the comparison. Observe late completions under the declared drain rule and report remaining incomplete or timed-out requests. Percentiles of successful completions alone can improve when the slowest requests disappear into errors. Show offered demand, actual dispatch, rejection, goodput, lengths, and resource occupancy alongside latency so a scheduler change can be judged against the same question.

The cache lab supplies a completely deterministic trace for checking replay discipline. Reset, set both C=4,s=4, predict twelve hits at sixteen initial requests, then take two Steps to reach eighteen requests and fourteen hits. Reset and set both C=4,s=4 again to reproduce the same initial and extended counts. Playback caps at 4,096; edits retain elapsed time. This model has no arrival timestamps, client capacity, inference engine, random outputs, or percentile measurements. It illustrates controlled trace and initial-state repetition without claiming to solve a real load-generation problem.

Expose dispatch delay in a four-request fixture

Intended arrivals are [0,10,20,30] ms. A constrained client actually sends at [0,100,110,120] ms and observes terminal times [100,110,120,130] ms. These are recorded timestamps on one clock, not a claim about an unobserved alternative arrival execution.

  1. Actual-send latencies are [100,10,10,10] ms, with mean 130/4=32.5 ms. They measure only the interval after each request was actually sent.

  2. Planned-start latencies are [100,100,100,100] ms, with mean one hundred. Dispatch delays are [0,90,90,90] ms and explain the difference exactly.

  3. The client did not maintain its intended offered timing. Report that failure and both boundaries; do not call 32.5 ms a faithful result for the planned independent-arrival workload, or call the entire planned-start interval server execution time.

The result

The timestamp record reveals 67.5 ms mean dispatch delay. A useful benchmark preserves intended and actual arrivals instead of hiding the discrepancy inside successful samples.

Explore the model

Interactive lab

Interactive lab · cache

Reproduce the same trace and initial state

Reset → set both C=4,s=4; predict twelve hits at sixteen initial requests, then two Steps give eighteen requests and fourteen hits. Reset and set both C=4,s=4 to reproduce. The deterministic trace caps at 4,096 and contains no arrival process, inference latency, client delay, or percentile estimator.

Reproduce the same trace and initial stateA fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Current readings: Hits / requests: 0 / 16; Hit rate: 0%; Address-stream period: 16 addresses. All parameters are adjustable with the labeled controls below.Fully associative LRU cache after 16 deterministic requests: 0 hits and 16 misses.Most recent 16 requestsaddress = i × 3 mod 160M3M6M9M12M15M2M5M8M11M14M1M4M7M10M13MCurrent cache order · oldest → newest471013Latest address 13 · miss: inserted as newestToy address stream · period 16 · starts empty
Cached addressMiss / evictionMost recent request
Hits / requests
0 / 16
Hit rate
0%
Address-stream period
16 addresses
t = 0 s

A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA replay comparison needs the same declared workload and initial state, plus evidence that the generator actually delivered it.

Check your understanding

A completion-gated client submits fewer requests when responses slow. What is the correct interpretation?

Try it yourself

An offered cohort has one hundred requests: ninety complete successfully, five time out, and five remain incomplete at the declared drain limit. May a p99 computed only from the ninety successes be reported as the p99 of all offered requests?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

A conditional successful-completion distribution excludes the very outcomes that may contain the worst delays.

Compare with the solution

No. It is a percentile conditional on the ninety successful completions and should be labeled that way. Report the five timeouts and five incomplete outcomes, their observation limits, and the offered-cohort qualification rule alongside it. A full latency distribution requires a defined treatment of those observations rather than silently dropping them. The success-only statistic can still aid diagnosis, but it does not establish a ninety-ninth-percentile bound for all one hundred offered requests.

Take it with you

  • Arrival timing and correlations are part of the workload contract.
  • Planned-start and actual-send intervals expose different delays and should be reported honestly.
  • Trace replay and tail claims need complete outcome, drain, warm-up, and percentile rules.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.