Request Scheduling and Admission Control
What a queue in front of a one-at-a-time engine does when traffic exceeds its capacity, measured on a live service and a simulator checked against queueing theory: four admission policies, the deadline that makes an answer worth having, who gets turned away, and what stale estimates cost.
In the clearest matched live comparison, four admissions policies received the same 279 requests over 40 seconds on a single-engine GPT-2 service. The offered work was about twice the engine’s then-current capacity. On the slower runs a 16-token generation took approximately 0.3 seconds, and the evaluation counted a response as useful only if the HTTP client received it within two seconds of sending the request. The input trace, model and service architecture were held constant across these four policy runs; the GPU was shared and its speed was monitored, not controlled.
Without an admission bound, all 279 requests eventually completed, but only 23 met the two-second objective: 256 arrived too late, the median completed-request latency was 26.5 seconds and its p99 was 57.5 seconds. Limiting the waiting queue to eight increased the in-time count to 48, although 86 of the 134 completed requests were still late and 145 were rejected. Adding expiry before service produced 185 in-time completions, 61 arrival rejections and 33 queue expirations. Predictive admission produced 224 in-time completions and 55 early rejections; no completed request was late in this particular run. These are four outcomes on one 279-request trace, not four steady-state capacity measurements.
The engine itself was not accelerated by admission control. The policy changed which work it undertook, when callers learned a request would not be served, and whether the service spent GPU time on an answer past its usefulness deadline. A sustained-trace early rejection returned in a median 2.3–2.5 milliseconds in the recorded runs. That is an actionable overload signal only if the response also identifies the cause and a realistic retry policy; a fast rejection by itself is not successful inference.
The question
Chapter 25 protected a stateful cached backend with one engine-wide lock. Requests waiting for that lock formed an implicit queue with no application-level capacity, no deadline admission and no structured overload refusal. This chapter replaces the implicit waiting with an explicit FIFO gate in front of the same one-at-a-time engine; it does not yet introduce continuous batching, concurrent GPU execution or cancellation of a generation already in progress.
Four questions guide the measurements. How does a single-server FIFO queue behave near and beyond capacity, and where do classical queueing formulas apply? Is a limit on request count enough to keep latency below a deadline when service times differ? Which request lengths receive service when an admission policy maximises in-time completions? Finally, how badly can a predictor mis-admit work when hardware speed or realised output length differs from its estimate? The live service tests the decisions; the simulator tests controlled variations; neither alone substitutes for the other.
Where this sits
Chapter 9 defined prefill, decode and latency metrics. Chapter 15 studied in-engine scheduling and continuous batching: choosing which requests participate in successive decode steps. Chapter 25 exposed a one-at-a-time cached backend through HTTP. Here scheduling means admission and order before a whole generation begins; once a request starts, it holds the single engine until completion. Chapter 27 will cover overlapping requests and streaming; Chapter 30 will cover cancellation, deadlines during generation and retries. These layers can interact, but this chapter measures only one of them.
Three systems papers place this small experiment in context; none of their performance figures is reproduced here. DistServe (OSDI 2024) defines goodput against time-to-first-token and per-output-token objectives while disaggregating prefill and decode. Sarathi-Serve (OSDI 2024) addresses chunked prefill and scheduling within a serving batch, rather than the whole-request gate used here. Mooncake, first circulated as arXiv:2407.00079 and subsequently published in FAST 2025 and in an expanded ACM Transactions on Storage version, describes prediction-based early rejection under overload in a much larger KV-cache-centred serving system. The connection is the admission idea, not equivalence between Mooncake’s architecture and this one-engine laboratory. The queueing-theory formulas below come from the M/G/1 literature and are checked separately against the simulator.
A queue in front of one engine
Utilisation, and what an unbounded queue does with it
Let requests arrive at an average rate \(\lambda\) per second, with independent service requirements \(S\). For one continuously available engine the offered load is \(\rho=\lambda\mathbb{E}[S]\); it is not necessarily the engine’s achieved utilisation when requests are rejected. Under Poisson arrivals, independent identically distributed service times, FIFO service, infinite waiting space and \(\rho<1\), the Pollaczek–Khinchine formula gives the mean waiting time in queue, excluding service time,
The book’s discrete-event simulator was checked against these classical formulas before it was used for policy sweeps. Its main workload draws requests of 4, 16 and 64 requested output tokens with probabilities 0.50, 0.35 and 0.15. Under the fitted, fast-state service-time model, mean service time is 0.1458 seconds (a notional capacity of about 6.86 requests per second for this offered mix) and the squared coefficient of variation is 1.41. The simulator’s M/M/1 and M/M/1/K checks deliberately use exponential service instead of this mix. Little’s-law agreement also checks event accounting; it is largely an accounting consistency check, not an independent empirical proof of the theory.
| Check | Simulated | Reference or interpretation |
|---|---|---|
| M/M/1 mean queue wait, \(\rho=0.5,0.8,0.9\) (200,000 arrivals per cell) | 0.999, 3.973, 8.862 s | 1.0, 4.0, 9.0 s |
| Little’s law at 0.9: \(\lambda\) × system time and time-averaged system occupancy | 8.859 and 8.859 | Consistency of counts and occupied time on the same simulated events |
| M/M/1/K blocking, nine cells (\(\rho=0.8,1.5,3.0\); total system capacity \(K=2,5,9\)) | Within 0.0025 | \((1-\rho)\rho^K/(1-\rho^{K+1})\), with \(K-1\) waiting places |
| Pollaczek–Khinchine, loads 0.5, 0.8, 0.9 with the fitted three-length mix (eight 20,000-second seeds) | 0.174, 0.686, 1.553 s mean queue wait | 0.176, 0.704, 1.584 s |
| Maximum wait in unbounded runs at load 1.3 and durations 60, 120, 240, 480, 960 s (ten seeds) | 18.7, 35.5, 72.0, 149.2, 286.3 s | Backlog-growth heuristic \((\rho-1)T\): 18, 36, 72, 144, 288 s; not an exact maximum-wait identity |
The final row shows the useful pattern: in these finite simulations, the maximum observed wait grew roughly in proportion to how long the engine was overloaded. Its closeness to \((\rho-1)T\) is a check of scale, not an exact queueing identity. The operational failure is that an unbounded queue provides no finite upper bound on a request’s waiting time under sustained excess load.
The simulator also exposes an error in the starter’s burst example. Ten simultaneous arrivals, two idle execution slots and four waiting places give capacity for six admitted requests: two begin service and four wait, leaving four rejected. The starter reported four admitted and six rejected because it tested the waiting limit before counting the two idle slots. The original starter remains in the repository as historical teaching material; the new simulator’s tests assert the corrected 6/4 partition. This two-server arithmetic check is not evidence that the live gate supports two concurrent engines: its executor has one worker.
The policies
Each policy decides on arrival whether a request can join the gate. Some also check feasibility again when the request reaches the head of the queue. The following four policies are the ones actually compared; the underlying Policy and decide code also contains an estimated-work limit that is not used as a separate arm.
- None: accept everything into unbounded FIFO; no deadline is imposed by the policy.
- Bounded: accept only while fewer than eight requests are waiting, excluding the one in service; no latency guarantee follows from this count.
- Bounded + deadline: keep the eight-place waiting bound and assign a two-second deadline to each admitted ticket; before a queued ticket starts, drop it if its estimated remaining service cannot fit the time left. This does not interrupt a running job.
- Predictive: no queue-length cap; at arrival, reject if the estimated wait plus service exceeds the ticket’s two-second deadline. Apply the same estimate-based expiry at the head of the queue. A bad estimate can still admit a request that finishes late, and an accurate estimate is not a hard reservation.
The simulator and live gate call the same pure decide rule. For one worker, it adds estimated unfinished work in the waiting queue, estimated remaining work in service and the new request’s estimated service time. The workers parameter divides that workload approximation by a worker count; that is not an exact multi-server completion-time predictor, and the live service has only one worker:
def decide(policy, queued, queued_work_s, in_service_remaining_s, est_service_s, deadline_s, workers=1):
wait = (queued_work_s + in_service_remaining_s) / workers
if policy.max_queue is not None and queued >= policy.max_queue:
return Rejection("queue_full", ..., retry_after_s)
if policy.max_queued_seconds is not None and queued_work_s + est_service_s > policy.max_queued_seconds:
return Rejection("work_limit", ..., retry_after_s)
if policy.predictive and deadline_s is not None and wait + est_service_s > deadline_s:
return Rejection("deadline_unreachable", ..., retry_after_s)
return None
An arrival rejection records a stable reason (queue_full, work_limit or deadline_unreachable) and emits Chapter 25’s error envelope with type overloaded; a ticket expired before service uses deadline_exceeded. Both use HTTP 503 Service Unavailable and an estimated whole-second Retry-After. Under RFC 9110, 503 describes temporary server overload and may supply a retry hint; the hint is not a reservation or a guarantee that a retry will succeed. HTTP 429 Too Many Requests, defined in RFC 6585, is appropriate for a rate policy applied to a client; no per-client quota is implemented here. Admission is early relative to engine execution, but not free: the Chapter 25 request parsing, schema checks and tokenisation occur before the gate makes this decision. Error-free retries, cancellation and the effects of clients following—or ignoring—Retry-After were not measured.
The gated request model adds optional deadline_ms; a compatibility test verifies that this one-field addition is accepted by Chapter 25’s request-schema classifier. If omitted, the selected policy supplies its default (two seconds for both deadline-aware policies). In the implementation the absolute deadline is created when Gate.submit runs, after parsing and tokenisation, not at socket arrival. HTTP-client latency is measured from the send time. The slight difference between those clocks matters near the boundary, so the two-second gate deadline is an estimate-based service policy rather than a guaranteed two-second HTTP response deadline.
The live gate
To put the gate between validation and computation, Chapter 25’s handler was split into prepare (readiness, tokenisation, budget and sampling), execute (the engine call) and finish (build the response). The underlying cached backend is still stateful and must not be entered concurrently. An asynchronous waiting queue now owns admission; its one-thread executor serialises the model work, replacing the route’s whole-request lock. Correctness is still serial execution, but waiting clients no longer occupy a dedicated engine thread.
ticket = gate.submit(lambda: execute(p), est, deadline_s) # raises RejectedError, never blocks
result = await ticket.future # waits its turn, or raises Expired
The gated handler is async def and waits on a future, rather than consuming a worker-pool thread for the duration of each queued request. That improves the placement of the queue: it is visible to decide, whereas the framework’s implicit threadpool waiting would not be. It does not mean a thousand waiting requests are free, nor that all policies bound them. Each accepted HTTP request still uses an ASGI task, request data, a connection and a future; the none and predictive policies have no hard queue-count or memory limit. End-to-end overload safety will require a separate limit on pending requests, outstanding memory and disconnected clients.
There is one subtle boundary in the queue count. A ticket submitted while the worker is idle is logically entitled to the service position before the worker coroutine gets scheduled; the gate’s _view treats the first queued ticket as occupying that position. Otherwise a burst can gain one unintended waiting slot. Tests compare the simulator’s admission arithmetic with the live gate’s burst behaviour: one in service plus the stated number of waiting places. This test proves admission accounting for the exercised burst; it does not demonstrate fairness among different callers or eliminate races with cancellation or disconnects.
The estimates
The estimate starts with a least-squares model, \(\widehat S(n)=a+bn\), for a whole GPT-2 generation of \(n\) new tokens under the fixed laboratory prompt. Two 84-measurement calibration rounds covered requested lengths 1, 2, 4, 8, 16, 32 and 64: the slopes were 8.38 and 8.61 milliseconds per token, with fitted intercepts near zero. Median absolute relative errors were 4.4% and 5.7%, but maximum observed errors were 23% and 28%. These errors are large enough to matter for a request close to its deadline, and a linear fit to one prompt is not a general predictor of prefill-heavy workloads or variable prompt lengths.
The calibration captured the faster state of a shared RTX 2060. Chapter 25 measured roughly 19 milliseconds per generated token in another run; attributing the difference to a competing process is plausible but was not independently diagnosed. During Chapter 26 the same 16-token task was observed near both 0.15 and 0.30 seconds, sometimes with the state changing inside a 40-second trace. The live gate therefore applies an exponentially weighted update (weight 0.2) to the ratio of observed engine time to its unscaled prediction, scaling subsequent estimates by that factor. This responds to completed jobs only: after an abrupt speed change it must first make decisions using stale evidence. The fixed-estimate mode provides a contrast, but the live passes comparing fixed and adaptive operation are confounded by changes in machine speed and offered effective load.
The experiment
Question. For one fixed 40-second arrival trace and a two-second client response objective, which admission policy yields the most in-time completed requests, how many requests does it reject or abandon, and which output-length classes receive that service? A separate experiment asks how sensitive the result is to the predictor’s knowledge of hardware speed and realised output length. The result for one trace must not be confused with the ten-load simulator sweep or with a capacity guarantee.
Hypotheses (to be tested, not assumed). H1: an unbounded queue loses deadline goodput approaching saturation and collapses under sustained overload. H2: a fixed count of waiting requests does not bound latency when service-time distributions or speed change. H3: predictive rejection increases in-time request completions compared with queue-front expiry, partly by favouring shorter work; request goodput and token goodput must be reported separately. H4: admission based on a stale fixed service-time estimate lets through work that a speed-tracking estimate would reject. These hypotheses concern this service, this workload and its chosen objective, not all inference engines.
Held constant. Across the four policy runs on a given live trace: one GPT-2 checkpoint behind the Chapter 10 cached backend, the same prompt and seeded sequence of requested output lengths, the same client-side two-second objective and a single engine per service process. The second pass rotated policy order and kept four servers resident to limit systematic order effects. Hardware contention and instantaneous engine speed were observed rather than controlled, so these are matched-arrival comparisons, not perfectly isolated hardware experiments.
Load. An open-loop generator schedules independent HTTP submissions at precomputed Poisson times, regardless of whether preceding calls have completed; the live runs use four nominal offered loads over 40 seconds and one simultaneous 30-request burst. The nominal \(\rho\) uses the fast-state calibrated capacity. Each live sustained run also reports an effective offered-load estimate, the nominal \(\rho\) multiplied by the observed engine-time/calibration ratio for completed jobs in that run. That factor is a retrospective description, not an arrival-time oracle. The simulation sweeps instead recompute arrival rate for each service-speed model to target the same dimensionless load on each model; they do not replay a fixed arrival rate across fast and slow speeds.
Measures. A response is good if its HTTP client receives status 200 with a completed answer within two seconds of sending it. A completed but slow answer is late; a refusal at submission is rejected; a previously admitted ticket dropped before execution is expired. Rejected and expired requests are not good completions, but they are still part of the denominator. Request goodput is good completions divided by the trace’s 40-second offered-arrival window, not by the later drain time. The main live-trace token metric sums requested max_new_tokens for the good requests; under these normal fixed-length runs it serves as an output-length proxy. In early-stop simulations requested lengths and realised lengths differ, and that proxy must not be called measured generated-token throughput.
Falsification criteria. H1 would be weakened if the unbounded service retained high in-time completion rates above capacity over increasingly long runs. H2 would be weakened if the eight-slot bound produced comparable latency when execution speed and service demand changed. H3 would be weakened if predictive admission did not improve the count of good completions over queue-front expiry, or did not change the request-length mix. H4 calls for a paired fixed-versus-adaptive experiment on the same service-time trace; the two historical live passes suggest its direction but do not by themselves establish a causal adaptive-control effect.
Results
An unbounded queue, at the calibrated speed
In the first live pass the policies were exercised sequentially, and GPU speed changed partway through. The first eight runs—the four sustained traces and burst for none, followed by the first three bounded traces—were close to the calibrated fast state. The table below reports only the four sustained unbounded traces from that period; it is evidence about backlog behaviour, not a fair cross-policy comparison.
| Effective load | Good / requests | Median latency | p99 latency |
|---|---|---|---|
| 0.50 | 152 / 152 | 0.20 s | 1.44 s |
| 0.89 | 93 / 279 | 2.50 s | 6.27 s |
| 1.28 | 45 / 380 | 12.2 s | 16.4 s |
| 1.97 | 36 / 579 | 26.6 s | 45.6 s |
At an estimated load of 0.89, the unbounded live queue delivered only 93 of 279 answers within two seconds even though all 279 eventually completed. This is consistent with the warning from Pollaczek–Khinchine: queueing delays can become large before offered utilisation reaches one. It is not an exact prediction of that finite trace. In the separate fast-state simulation at nominal load 0.9, approximately 70% rather than 33% met the same objective; its theoretical mean queue wait is approximately 1.58 seconds. Burstiness of a finite seeded trace, run conditions and model-versus-engine timing can all alter the realised fraction. For loads above one the 40-second experiment additionally accumulates backlog until the submissions end. H1 is supported qualitatively, with a large finite-run spread that the chapter should not conceal.
Four policies at an effective load of two
Because the first pass mixed two machine speeds, the comparison in this section comes from the second pass: the same nominal-load-0.9 arrival trace was submitted to four independently running service processes, one policy at a time with rotated order. Probes before and after these particular runs gave approximately 0.29–0.32 seconds for 16 tokens; retrospectively estimated effective loads were close to two, though not numerically identical. The four service processes remained resident, and no observed speed transition occurred in these selected runs. The selected trace is the strongest local comparison, but one observation per policy does not give a confidence interval or isolate all GPU interference.
| Policy | Good | Late | Rejected | Expired | Median / p99 latency | Good tokens/s |
|---|---|---|---|---|---|---|
| none | 23 | 256 | 0 | 0 | 26.5 / 57.5 s | 5.9 |
| bounded, 8 waiting | 48 | 86 | 145 | 0 | 2.4 / 4.6 s | 11.1 |
| bounded + deadline | 185 | 0 | 61 | 33 | 1.1 / 2.0 s | 52.1 |
| predictive | 224 | 0 | 55 | 0 | 1.5 / 2.0 s | 52.4 |
(Each row has 279 offered requests. The Good, Late, Rejected and Expired columns partition that total. The median and p99 are computed over completed responses only, thereby excluding fast refusals and expirations; they are not overall client-outcome percentiles. Good tokens/s sums the requested output lengths of on-time completions and divides by the 40-second offered-arrival window.)
Eight waiting places reduced the unbounded backlog but did not meet the objective: 86 of its 134 completed responses were late, with p99 completed-response latency 4.6 seconds. In this trace the deadline-aware policies completed no request late, by rejecting or expiring work rather than making the engine faster. The predictive gate produced 224 good responses, 39 more than the bounded-plus-expiry gate’s 185, and rejected 55 immediately; the latter rejected 61 and allowed another 33 to wait before expiring. The predictive advantage is in good request count, not proportional delivered output work: their recorded good-token rates are 52.4 versus 52.1 requested tokens per second. These results are conditional on the prediction and on the two-second objective; a running request remains non-preemptible.
H2 — the count limit is speed-dependent. The same seeded 279-arrival trace and eight-place waiting limit gave 233 on-time completions with p99 completed-response latency about 2.2 seconds in the fast-state first pass, but 48 with p99 4.6 seconds in the roughly 2.2-times-slower second pass. The offered request times match, but the machine conditions and run context do not; this is an instructive observational contrast. The controlled simulator sweep below independently varies service speed, while keeping each row’s offered utilisation normalised to the corresponding model’s capacity.
The sweep
The simulator evaluated four policies at ten target offered-load values, with 20 seeds of 600 seconds per cell, using the calibrated service model and a version with every service time multiplied by 2.25. In each scenario the arrival rate was recomputed as \(\lambda=\rho/\mathbb{E}[S]\). Thus equal Load labels mean equal offered utilisation relative to that scenario’s capacity, but not equal requests per second or the identical Poisson arrival trace across the two speed scenarios. The table entries are mean fractions of offered requests completed within the fixed two-second objective, not measured service-level guarantees. Selected rows from the fast-state sweep are:
| Load | none | bounded, 8 | bounded + deadline | predictive |
|---|---|---|---|---|
| 0.6 | 0.99 | 0.99 | 0.99 | 1.00 |
| 0.9 | 0.70 | 0.91 | 0.93 | 0.98 |
| 1.0 | 0.22 | 0.86 | 0.89 | 0.97 |
| 1.3 | 0.01 | 0.71 | 0.77 | 0.93 |
| 2.0 | 0.00 | 0.47 | 0.52 | 0.83 |
| 3.0 | 0.00 | 0.30 | 0.35 | 0.72 |
For the 2.25× slower service model, with its own arrival rate chosen to yield the same displayed \(\rho\):
| Load | none | bounded, 8 | bounded + deadline | predictive |
|---|---|---|---|---|
| 0.6 | 0.87 | 0.88 | 0.97 | 0.97 |
| 0.9 | 0.43 | 0.66 | 0.94 | 0.94 |
| 1.0 | 0.15 | 0.58 | 0.93 | 0.93 |
| 1.3 | 0.01 | 0.37 | 0.87 | 0.90 |
| 2.0 | 0.00 | 0.18 | 0.71 | 0.83 |
At normalised load 1.0, the eight-place count rule achieved 86% on-time at the fast model’s scale and 58% at the slow model’s scale; the deadline-aware variants achieved 89%/93% and 97%/93%, respectively. Because arrival rates were renormalised for each model, these rows show how absolute service duration relative to a fixed two-second deadline changes outcomes even at the same utilisation; they are not a same-arrivals experiment. H2 is supported: waiting-slot count alone sets neither a seconds-of-work bound nor an end-to-end response-time guarantee. A deadline expresses the desired objective more directly, but is enforced here through fallible estimates and a check before—not during—execution.
At normalised load 2.0 in the fast-state simulation, predictive admission achieved a good fraction of about 0.83 versus 0.52 for bounded-with-deadline. Their on-time request rates were approximately 11.3 and 7.2 per second, apparently above the mix’s nominal capacity of 6.9 requests per second. There is no capacity violation: 6.9 is the capacity for the offered mix of 4-, 16- and 64-token jobs. Rejecting many costly 64-token jobs changes the mean service requirement among those actually run; more short completions can fit in one second. The two policies delivered almost the same amount of requested output work within the deadline—118.4 versus 117.8 requested tokens/s, a difference of roughly 0.5%. Optimising request counts and optimising useful generated work are distinct objectives.
Who is turned away
A policy’s total good count can conceal which requests it serves. The matched live trace at effective load near two offered 141 requests for 4 tokens, 93 for 16 and 45 for 64; the percentages below are good completions divided by the number offered in each length class, including the ones rejected or expired:
| Policy | 4 tokens | 16 tokens | 64 tokens |
|---|---|---|---|
| none | 11% | 8% | 2% |
| bounded, 8 waiting | 22% | 17% | 2% |
| bounded + deadline | 74% | 77% | 18% |
| predictive | 99% | 86% | 9% |
The predictive gate met the two-second objective for about 99% of offered four-token requests but only 9% of offered 64-token requests. Of its 55 arrival rejections, 41 were from the 64-token class, although that class represented only 45 of the 279 arrivals. The bounded-plus-deadline gate rejected or expired 94 jobs, including 37 from that longest class. At the slower observed speed a 64-token job is estimated to require roughly 1.2 seconds, leaving at most 0.8 seconds for queueing; a four-token job needs roughly 0.08 seconds, so it can fit behind much more work. In the calibrated-speed simulator at load 3, predictive admission served approximately 97%, 65% and 2% of the three classes. The precise rates depend on the trace and predictor, but the exclusion mechanism is built into the shared two-second deadline.
This is not a free optimisation. Maximising the number of on-time completions under a common deadline rewards accepting shorter requests and can systematically exclude expensive ones. That may be acceptable when each completed call has equal value, but not when longer requests serve equally important users or require more work for legitimate reasons. A service could reserve capacity by class, impose fairness or age-based priorities, or set class-specific objectives; none was implemented or benchmarked here. A release should report goodput by class alongside total request and token goodput, rather than hiding this policy choice behind a single headline number.
A burst
The 30-request simultaneous burst offered roughly ten seconds of work at the observed slower speed, far more than one non-preemptive engine could finish within a two-second response objective. Some subset can still meet the deadline, depending on arrival order, request lengths and what is rejected or expired. The comparison therefore asks how many in-time completions each policy extracts from this particular burst, not whether every policy can satisfy all thirty.
| Policy | Answered | Good | Rejected | Expired | p99 |
|---|---|---|---|---|---|
| none | 30 | 3 | 0 | 0 | 11.4 s |
| bounded, 8 waiting | 9 | 3 | 21 | 0 | 5.3 s |
| bounded + deadline | 7 | 7 | 21 | 2 | 2.0 s |
| predictive | 4 | 4 | 25 | 1 | 1.0 s |
With no admission rule, the engine eventually answered all thirty burst requests but only three met the two-second objective; the remaining twenty-seven completed too late. The bounded-plus-deadline policy produced seven good completions, while predictive admission produced only four: early rejection was not the best of the four policies on this trace. The predictive gate rejected twenty-five at submission and later expired one. The simulator disagreed materially about this small burst, predicting six fewer arrival rejections than observed. Rejection responses during the burst had tens-of-milliseconds latency, not the 2.4-millisecond median of the sustained-trace runs; the specific outcomes depend on ordering and gate-state timing.
What the controller must know
Both deadline-aware policies depend on estimated service time. The experiments expose two different failures: calibration drift, when the hardware executes more slowly than the model predicts, and workload overprediction, when a request asks for more tokens than it actually generates. The first risks false acceptance and late answers; the second risks false rejection and unused capacity. These are distinct error directions and call for separate validation.
Stale hardware calibration. The first live pass used the fixed fast-state fit while the machine later slowed by about 2.2×. Across the reported first-pass traces, 85 of 574 completed jobs (14.8%) under bounded-plus-deadline and 197 of 819 (24.1%) under predictive admission finished outside the two-second objective. In the later interleaved pass using an exponentially weighted speed factor, the corresponding counts were 1 of 764 and 0 of 1,109. These are striking recorded differences, but not a paired A/B test: trace order, effective load and speed conditions were not held equal. They support the plausibility of H4 and the need to measure current service speed; they do not prove that speed tracking caused the entire reduction. A stronger experiment would replay the same arrival and realised service-time sequence through fixed and adaptive estimators.
Overestimating work when requests stop early. In 60 real GPT-2 generations requesting up to 64 tokens with stop=["."], 56 stopped on the period and four reached the limit; the median completion used 8.5 tokens (13% of the maximum), with a range from 1 to 64. The resulting simulation defined offered load using a mean realised service time of about 0.032 seconds, rather than the 0.146 seconds of the original full-length mix. It then compared an idealised predictor that knows each job’s final token length with one using max_new_tokens. At offered loads 0.9, 1.3 and 2.0, the saved results report 16,740 versus 16,003; 23,472 versus 21,328; and 32,939 versus 28,199 good completions over 600 seconds—approximately 4.4%, 9.1% and 14.4% fewer in the maximum-based arm. These differences must be treated as illustrative, not a clean paired treatment effect: the implementation advances a shared random-number generator separately for the two arms, so they receive different resampled realised lengths despite sharing the Poisson arrival times. Furthermore, its good_tokens_per_s field sums Arrival.new_tokens; that field contains the realised length in the oracle arm but the requested maximum in the other arm, making the saved token-goodput columns incomparable and sometimes physically misleading. The intended lesson remains: a safe maximum-based prediction can waste deadline-feasible capacity when early stopping is common. A definitive comparison requires identical realised jobs in both arms, separate estimated and actual token counts in every record, and repeated seeds.
An earlier pilot held the arrival rate derived from full-length jobs while allowing early stopping to cut actual service work sharply; it therefore failed to create the intended overload condition and showed almost no policy difference. The corrected run defines offered load from realised work, but still needs paired sampled completions to isolate the estimator effect. Both lessons belong in the experiment record: check that the workload is truly overloaded, and ensure treatment arms see the same underlying jobs before attributing a difference to the admission policy.
The simulator against the service
The simulator was checked against all 20 runs of the second live pass by replaying the scheduled arrivals and, where available, the engine times observed for completed jobs; it scaled estimates using one retrospectively measured speed factor per run. Across 5,680 offered requests, the sum of absolute per-run count differences was 89 for good completions (1.6% of offered requests), 89 for arrival rejections (1.6%), and 31 for expirations (0.5%). These are aggregate count deviations, not proof that 98.4% of individual requests received the same decision. The largest deviations occurred in the predictive burst (seven good and six rejected by count), bounded at nominal load 0.9 (seventeen good and eleven rejected), and predictive at 1.3 (twelve good, seventeen rejected and twenty expired). The replay uses a single run-level speed estimate and lacks the live gate’s changing per-completion scale, asynchronous timing, and some rejected jobs’ otherwise-unobservable service times. Its fit is useful but incomplete; the burst disagreement was not diagnosed.
simulate and Gate invoke the same decide function, and their unit tests exercise matching admission counts on controlled bursts. That gives confidence in the shared policy rule. It does not establish full behavioural equivalence between the discrete-event model and the HTTP service: queue wake-up timing, adaptation, request preparation, transport and cancellations sit outside the shared function. The per-run differences above should remain visible as simulation-model error, rather than being explained away solely as GPU noise.
What a refusal costs
On sustained traces, an arrival rejection returned in a median 2.3–2.5 milliseconds (p99 3.5–4.8 milliseconds); in the 30-way burst the median rejection response cost rose to roughly 43–55 milliseconds (p99 up to 65 milliseconds). An expiry after waiting consumes an open client request and queue occupancy only to declare later that no useful completion is expected. In this comparison the bounded-plus-deadline gate expired 33 of the 279 offered requests, whereas predictive admission rejected 55 at the door and expired none. Its observed Retry-After hints ranged from 1 to 7 seconds and were generated from estimates, not from a guaranteed future free slot; multiple simultaneous retries could overload the server again. Chapter 30 must address client retry behaviour, backoff, disconnects and cancellation, which are absent here.
What the numbers do not show
- A shared GPU with two observed speed states. Hardware contention was not controlled. The first live pass used fixed estimates, the second speed tracking, and they differ in more than one condition; no causal fixed-versus-adaptive conclusion follows from that comparison alone. Some second-pass runs also changed speed internally.
- One whole-request execution slot. The service uses a one-worker executor and FIFO tickets. Continuous batching, multiple real engine replicas, preemption, token-level TTFT/TPOT objectives and streaming are out of scope. A multi-server simulation is checked for conservation and parallelism, not validated as a live multi-worker server.
- One Poisson mix and one burst. The live runs use the same seeded arrival trace per policy but a single 40-second observation per cell; 20-seed simulator sweeps provide replication only within the model. Policies have no independently measured confidence intervals on live traffic.
- Equal utilisation is not equal arrival traffic. The two-speed sweeps recompute request arrival rates for the fast and slow capacities, so their rows are matched on normalised offered load, not on physical requests per second.
- Forecasts are not guarantees. Deadlines are established when the gate admits a parsed request, not at HTTP arrival; finish-time estimates can be wrong, and a job already in service is allowed to overrun. There is no cancellation of work in progress.
- Early-stop comparison is not fully paired. Although both arms share scheduled Poisson arrival times, they draw different realised lengths from a shared advancing random stream. Its reported token-goodput numbers also mix requested and realised lengths, so those values must not be interpreted as actual generated tokens/s.
- Aggregate simulator agreement. Replay differences of 1.6% by counts do not prove event-level decision equivalence. Adaptation inside a run and unobserved service demand for rejected requests remain unmodelled.
- Fairness and resources. A common deadline systematically favours short jobs; no per-client quotas, isolation, fairness reservation, memory admission, queue-memory cap, disconnection cleanup, TLS, authentication or production load-balancer integration was tested.
- A fixed two-second completion objective. Different request classes, priorities or first-token constraints could produce a different preferred policy. Request goodput and useful-work goodput must remain separate.
Inference Lab increment
examples/ch26/scheduler_lab.py turns Chapter 25’s serial service into a testable admission laboratory, not a production scheduler. The model fit, simulation, gate, trace generator and recorded runs can be inspected separately. The additions are:
ServiceModelandfit_service_model: a fitted affine estimate of whole-request GPU execution time, plus residual-error statistics.Policy,decideandcannot_finish: a shared estimated-work admission rule and a queue-front expiry test; both operate before an engine call, with no in-flight preemption.simulate, queueing closed forms andsummarise: a discrete-event FIFO model, M/M/1, M/M/1/K and Pollaczek–Khinchine checks, and good/late/rejected/expired counts. The multi-server workload formula is approximate and not validated against a live multi-server backend.Gateandbuild_gated_app: one asyncio waiting queue and one engine thread, optional EWMA speed tracking, validateddeadline_ms, 503 error envelopes, estimatedRetry-Afterand/stats.run_trace_httpandGatedServer: an open-loop HTTP workload generator and an isolated server process for each policy.theory,starter,calibrate,real,compare,sweep,estimationandserve: repeatable command entry points with evidence saved inresearch/ch26/. The currentestimationcommand still needs paired realised-token draws and a separate actual-token field before token-goodput claims are publication-grade.
To run the gated service with the predictive policy:
python examples/ch26/scheduler_lab.py serve --policy predictive --device cuda --port 8000
The operational rule is: make an explainable admission decision before expensive engine work, and test each estimate against observed execution. A deadline-aware gate can avoid spending scarce service time on a response already predicted to be useless, but it does not create capacity. It must expose the counts of good, late, rejected and expired outcomes; record requested and actually generated tokens separately; and reveal which request classes lose out. In a real service, the rule also needs independent limits on queue memory, cancellation and retry behaviour, while continuous batching and memory-based admission remain separate design problems.
What you should now be able to do
- Derive offered load and the expected queue wait for a stable M/G/1 queue, naming the assumptions, and explain why overload has no stationary unbounded-queue wait.
- Distinguish total system capacity from waiting places and reproduce the starter’s corrected two-server burst count.
- Implement a count-bound, an expiry check and predictive admission; say why none guarantees a client-side deadline without accurate service estimates and in-flight cancellation.
- Report offered, good, late, rejected and expired requests alongside class-specific rates, requested-token throughput and actual-token throughput where measured.
- Tell apart same-arrival-trace comparisons, same-normalised-load simulation comparisons and uncontrolled differences in machine speed.
- Test a simulator against classical theory and against per-request live outcomes, not just aggregate counts; make early-stop A/B arms share the exact same underlying realised work.
- Explain when 503 with a retry hint is appropriate and when per-client 429 rate limits would be a different policy.
Key terms
- Offered load (\(\rho\)): arrival rate multiplied by the mean service requirement, divided by the number of equivalent servers; for this one-engine chapter \(\rho=\lambda\mathbb{E}[S]\). It can exceed one, unlike achieved utilisation.
- Admission control: a decision on whether an already parsed and budget-checked request may begin waiting for engine execution.
- Waiting-capacity bound: the maximum number of waiting tickets, excluding those occupying execution slots.
- Deadline: a latest useful completion time; here the gate constructs it at ticket submission and checks estimated feasibility before service, not throughout execution.
- Predictive admission: refusal when estimated waiting plus service time exceeds remaining deadline budget.
- Request goodput: completed HTTP responses within the objective per unit offered-arrival time.
- Token goodput: output tokens from on-time completions per unit time; the main experiment proxies this using requested lengths, while the early-stop simulation cannot use that proxy across arms.
- Open-loop arrivals: submissions scheduled independently of earlier request completion.
- Effective offered load: nominal load multiplied by a retrospectively observed relative service-time factor for a live run.
- Little’s law: average number of requests in a stable system equals the achieved arrival/departure rate multiplied by mean time in the system.
Reader exercises
- Pair the early-stop experiment. Precompute
(arrival_time, requested_tokens, actual_tokens, true_service_seconds)once and feed those identical records to the oracle and maximum-based estimators. Recompute request and actual-token goodput and quantify the difference from the published unpaired run. - Compare equal traffic as well as equal load. Rerun the fast/slow sweep with the same absolute arrival rate and realised jobs, then rerun at separately normalised utilisation; explain the difference between those questions.
- Add a reserved capacity share so that the 64-token class meets at least 25% of its offered requests; report the cost to other classes and to useful generated-token goodput.
- Make admission account for KV-cache and queued-request memory as well as predicted GPU time. What happens when many tiny jobs wait behind a long one?
- Introduce a second live backend and compare the multi-server gate with the simulator; test whether dividing total queue work by worker count predicts finish time accurately enough.
- Use paired simulated service times to compare fixed versus adaptive EWMA calibration after an abrupt slowdown and then recovery. Measure late completions and false rejections.
- Add per-client token buckets and document the distinction between their 429 and the global gate’s 503, including retry strategies and request identifiers.
- Cancel or abandon disconnected and overdue work safely, including a job already running, then compare useful work and wasted GPU time (Chapter 30).
- Rerun the live comparison on an isolated GPU with multiple independent traces; report confidence intervals and per-class fairness rather than relying on a single 40-second run.
References
- DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving — Zhong et al., OSDI 2024; goodput against first-token and per-token objectives, and prefill/decode disaggregation. Its authors’ speed-up claims are not reproduced here.
- Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve — Agrawal et al., OSDI 2024; chunked prefills and iteration-level serving policy; distinct from this whole-request admission gate.
- Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving — Qin et al., ACM Transactions on Storage, accepted in 2025, with an earlier arXiv version and related FAST 2025 paper; prediction-based early rejection under overload. These are the authors’ results, not local measurements.
- The M/G/1 Queue and the Pollaczek–Khinchine Formula — Stanford course notes; the Poisson-arrival, IID-service, stable-FIFO assumptions underlying the mean queue-wait formula.
- The Tail at Scale — Dean and Barroso, Communications of the ACM (2013); why latency tails and high variability matter to service objectives. Context rather than a reproduced experiment.
- RFC 9110: HTTP Semantics — 503 Service Unavailable and the optional
Retry-Afterhint; no guaranteed capacity reservation. - RFC 6585: Additional HTTP Status Codes — Section 4 defines 429 Too Many Requests for rate-limited clients; per-client rate limiting was not built here.
Evidence in this chapter
| Claim | Evidence category and limit |
|---|---|
| M/G/1 queue wait, M/M/1/K blocking, and Little’s law | Established queueing theory; simulator checked against formulas and accounting identities, not a new derivation |
| Approximate \((\rho-1)T\) overload backlog growth | Queueing heuristic; finite-run maximum waits are observed values, not an exact identity |
| Starter burst: two servers plus four waiting places admit 6, reject 4 | Corrected arithmetic and simulator unit test; not a two-server live run |
| Unbounded queue at estimated loads 0.89 and 1.97 delivered 93/279 and 36/579 in time | Book result, single fast-state traces; not exactly predicted by P–K and no confidence intervals |
| Four admission policies delivered 23, 48, 185, 224 on-time completions from 279 offered requests | Book result, one matched arrival trace per policy at similar but not identical effective loads |
| Eight waiting places delivered 233/279 on time in a fast-state pass and 48/279 in a slower pass | Observational same-trace, different-speed comparison; other run conditions not isolated |
| Fast- and slow-state 20-seed simulation sweeps | Book result; arrival rates renormalised by each model’s capacity, not equal physical arrival traffic |
| Predictive admission favoured four-token requests (99% good) over 64-token requests (9%) | Book result for one matched live trace, supported by simulation; important fairness cost |
| Request goodput can exceed the offered mix’s 6.9 requests/s nominal capacity, while useful requested-token rates are similar | Book result and changed admitted-job mix; not an increase in engine speed |
| Fixed first-pass estimates produced 85/574 and 197/819 late completions; adaptive second pass produced 1/764 and 0/1109 | Book observations; confounded cross-pass comparison, not causal proof of EWMA benefit |
| Early-stop oracle versus max-based estimate: saved good counts differ 4.4%, 9.1%, 14.4% | Book simulation on resampled stop fractions; arms not paired on realised lengths, so effect sizes are provisional |
| Token goodput in the early-stop simulation | Not validly comparable: one arm counts realised tokens and the other requested maxima |
| Simulator versus service: sum of absolute per-run count differences of 1.6%, 1.6%, 0.5% | Book result for good/rejected/expired; not per-request decision agreement |
Fast early refusal with 503 and estimated Retry-After |
Book measurement plus RFC 9110 semantics; not a promise of retry success |
| DistServe, Sarathi-Serve, Mooncake | Independent published systems work; their performance results were not reproduced |
| Production multi-engine scheduling, fairness guarantees, in-flight cancellation, retry storms, client disconnection and memory-aware admission | Not measured or not implemented |
Implementation status
- Manuscript:
content/books/inference/26-chapter.md. - Runnable examples:
examples/ch26/admission.py(original toy simulator, preserved);examples/ch26/scheduler_lab.py(shared policy, event simulator, single-worker gate, HTTP load generator and experimental commands). Chapter 25’sservice_lab.pywas refactored intoprepare,executeandfinishwithout changing its intended API semantics. - Tests:
tests/test_ch26_admission.py,tests/test_ch26_scheduler_lab.py(40 CPU tests covering the fitted model and arithmetic, policy decisions, FIFO/burst admission counts, deadline expiry, speed adaptation, single/multi-server simulation conservation, theory checks and gated HTTP refusal). They do not constitute a production traffic qualification or a paired early-stop predictor study. - Recorded evidence:
research/ch26/sources.md,research/ch26/results.json,research/ch26/service_model.json, the compressed per-request HTTP runs inresearch/ch26/raw/, andresearch/evidence-register.md. - Recorded verification command:
python -m unittest discover -s tests -v. This editorial revision audited stored code and results; it did not rerun that test suite or GPU benchmarks. - Open lab defects: pair realised-work draws between the two early-stop arms; separate
requested_new_tokensfromactual_completion_tokensin all simulated records and summaries; validate admission against an absolute client-arrival deadline and cancellation; add a bounded pending-memory budget and multi-worker conformance checks.
This is a research-backed, executable laboratory chapter, marked draft = false in the site front matter—not a production qualification. The supported conclusion is that an explicit deadline-aware gate improved in-time completions dramatically on the recorded one-engine overloaded trace, but traded that gain against early refusals and exclusion of longer requests. Its exact advantages remain dependent on predictor accuracy and workload mix; the early-stop simulator has two known comparison defects, and the fixed-versus-adaptive live contrast is confounded. Chapter 27 continues with request overlap and streaming, where a single whole-request execution slot is no longer an adequate serving design.