Hypothetical scenario. Northwind’s request measurements show short and long conversations sharing serving capacity. A sequence finishes while another continues. Maya asks why queued work still waits; Dev considers iteration-level scheduling, and Priya asks what memory the new request will need as it grows.
Maya: “A finished sequence should not make another request wait for the longest answer.”
Dev: “Continuous batching can admit work between generation iterations.”
Priya: “Reuse the opening only when the growing state remains within the admission budget.”
You will separate continuous batching from PagedAttention, then connect their scheduling and KV-management roles to vLLM and TensorRT-LLM. Derive reusable slots in the teaching example without treating them as measured GPU capacity.
When can finished work make room for another request?
Continuous batching allows scheduling decisions across generation iterations rather than holding an entire request batch until its longest sequence finishes. PagedAttention manages logical KV state using blocks rather than requiring one expanding contiguous reservation. These are complementary scheduling and memory-management decisions. The vLLM paged-attention design explains block-based access. TensorRT-LLM's architecture documentation gives another concrete serving stack; compare supported scheduling, kernels, quantization and adapter behavior for the actual deployment.
Hypothetical scenario. Three active sequences need four, two and one further decode iterations. Under a simple one-slot-per-sequence model, reserving all three slots for four iterations allocates 3 × 4 = 12 slot-iterations. Their useful demand is 4 + 2 + 1 = 7, leaving five potentially reusable slot-iterations. Admitting replacement work can use those openings, but actual kernel efficiency and memory limits are not established by this count. Admission must account for the memory that new requests will grow into, not just their first iteration.
Two requests enter the same queue with very different work
Northwind receives a short policy lookup and a document-heavy investigation at the same moment. Dev's router sends both to a preferred model because its historical average quality looks good. Sam sees the long request hold cache while short requests wait, and Priya notices that the cheaper fallback cannot satisfy the investigation's evidence contract.
The routing decision needs more than a model name. Identify allowed data destinations, required capabilities, context limits and task acceptance. Then consider current capacity and the request's deadline. A model can be eligible yet temporarily unavailable; an idle model can be ineligible. Keeping those distinctions explicit makes rejection and degradation understandable.
Let completed sequences release actual capacity
Hypothetical scenario. Continuous batching can admit new work as sequences finish instead of waiting for an entire fixed batch. The scheduler still must account for token shapes, memory and shared prefill/decode work. A freed request slot does not necessarily equal enough KV capacity for any waiting request.
| Artifact | Concrete evidence | Decision boundary |
|---|---|---|
| Waiting request | input/output limits, priority, deadline | Eligible admission |
| Active sequence | KV allocation and decode state | Actual occupancy |
| Scheduler decision | engine/config generation, grants | Reproducible policy |
Paged KV management changes allocation and reuse behavior; it is not unlimited memory. Record the selected engine, layout, block policy and cancellation lifetime. Compare vLLM and TensorRT-LLM under a common task, hardware and workload contract rather than transferring one engine's configuration semantics to the other. Track queue age and useful completion by request class so long prefills cannot silently consume all short-request capacity.
Form an eligible set before choosing a preferred destination
Eligibility includes the caller's permissions, input modalities, tool contract, evidence requirements and allowed processing locations. Enforce these rules outside a generated classification. A model that predicts “simple request” cannot authorize sending protected text to a destination that the application disallows.
Within the eligible set, routing can use measured task behavior, selected cost assumptions and workload constraints. An intent classifier is one possible hint. Its errors belong in evaluation: an apparently easy request can contain a rare condition that requires a different model or a human decision. Preserve a route reason and fallback policy with the request.
The existing model-boundaries chapter defines an accepted task comparison. Routing applies that comparison to subsets of traffic and current conditions. It should not quietly replace the original task with whatever behavior an available destination happens to provide.
Request rate, work allowance and concurrency measure different pressure
A request rate counts arrivals over time. A token allowance accounts for a selected amount of input and possible output work. Concurrency counts work still outstanding and can reflect held cache or remote resources. All three can matter, and limiting one does not impose a reliable bound on the others.
Two requests can differ greatly in input size, output bound and service time. A requests-per-second policy that treats them equally may admit a harmful burst of large requests. Conversely, a token allowance alone can permit too many small slow tasks that wait on tools. Add limits for the actual held resources rather than assuming one currency captures every bottleneck.
Token counts also depend on the destination's tokenizer and representation. Do not transfer a reservation between providers as if one reported token meant identical work everywhere. Define the budget unit and recompute it when the request format or selected destination changes.
Reserve a bounded amount before spending it
Hypothetical scenario. Choose a bucket capacity of 10,000 work tokens with 8,000 currently available. A request has a selected 4,000-token input and a maximum 3,000-token output. Reserving the full selected bound requires 4,000 + 3,000 = 7,000 tokens, leaving 8,000 − 7,000 = 1,000 available.
A second request needs a reservation of 3,000. It cannot fit immediately. If the chosen refill rate is 2,000 tokens per second and no other work consumes tokens, one second adds 2,000 and makes 3,000 available. That is a toy budget calculation, not a promise about accelerator throughput or a provider's billing policy.
If the first request actually uses 4,000 input and 1,000 output tokens, its selected actual total is 5,000. The unused 2,000 reservation can be reconciled according to the budget policy. Guard against double reconciliation when a response is retried or completed twice. An uncertain attempt may have consumed remote work even when the client has no final usage record.
A queue stores waiting; it does not create service capacity
Choose a fluid approximation with 120 requests per second arriving and 100 requests per second completing. Outstanding work grows at 120 − 100 = 20 requests per second while those rates persist. In ten seconds, the selected growth is 20 × 10 = 200 requests. Real requests vary, but this simple imbalance already rules out an indefinitely stable queue.
A chosen queue with 60 requests ahead of a new arrival and a service rate of 20 requests per second suggests 60 / 20 = 3 seconds of waiting under a simple steady service approximation. If the request has only two seconds left, accepting it into that queue cannot satisfy that assumed deadline. Reject or offer an explicit asynchronous outcome rather than promising an interactive response.
Bound queues by both work and time. Cancel expired work and account for whether remote execution actually stops. A caller disappearing from the connection does not prove a provider released capacity. Keep the admission state tied to the executor's completion or cancellation contract.
Compute route economics from accepted results
For a selected 1,000-task comparison, assume 800 tasks go to route A at $0.01 each and 200 to route B at $0.05 each. The chosen inference subtotal is 800 × $0.01 + 200 × $0.05 = $8 + $10 = $18. An assumed router cost of $2 raises the total to $20.
If 900 tasks satisfy the shared acceptance contract, cost per accepted task is $20 / 900 ≈ $0.02222. Sending all tasks to B at the selected price costs $50, but the accepted-task denominator must also be measured before comparing quality-adjusted cost. These prices and outcomes are deliberately hypothetical, not vendor offers or reported deployment results.
Include misroutes, retries and fallback work. A cheap first route followed by an expensive second route can cost more than choosing the second route once. A route that violates a required task constraint is not repaired by reporting a favorable average price.
Priority needs an explicit policy and a starvation limit
Protecting interactive requests can be appropriate, while lower-priority batch work still needs a defined service or rejection contract. A single global queue can allow one tenant's long requests to dominate. Per-tenant work budgets and fair scheduling address a different concern from choosing the most accurate model.
Review what counts as priority and who may set it. Do not trust a client-supplied “urgent” label without authorization. Record how long work may wait and what happens when its service class cannot be met. Priority is a resource policy, not a model's opinion about the importance of a customer.
In the wild: concurrency control uses observed latency
Envoy's adaptive concurrency documentation describes a controller that adjusts outstanding requests using latency observations and a reference condition. It is an implementation example of protecting a service using signals beyond arrival rate. Its assumptions and measurement behavior matter; an adaptive limit is not a model-quality evaluator.
Hypothetical scenario. Northwind enables retries in both the gateway and client during overload. Extra attempts increase work while each layer believes it is improving availability. Restore one bounded retry owner, preserve the original deadline and observe admitted work rather than only successful responses.
Batch scheduling remains inside the serving contract
After admission, a serving engine may batch compatible work. That scheduling can improve device use while changing waiting and cache pressure. The vLLM optimization documentation describes tuning concerns for its serving implementation. Evaluate the chosen limits under the actual input and output distribution rather than copying a default as a capacity guarantee.
Do not merge unrelated tenants' authorization or evidence state because their arithmetic can share a batch. Physical co-scheduling and logical isolation are separate concerns. Preserve request identity, cache boundaries and cancellation accounting even when operations execute together.
Route when the task evidence supports differentiated handling
Routing is useful when tasks have meaningful capability or cost differences and their classification can be evaluated. A single accepted model can be simpler when traffic is homogeneous or misroute consequences dominate the expected saving. Admission remains necessary either way because even one model can receive more work than it can complete within the deadline.
Release route rules, model identities and evaluation records together. Inspect rare categories and overloaded conditions as well as normal average traffic. A router optimized against yesterday's task mix can become inappropriate when request lengths or failure categories change.
Count rejected and expired work beside completed requests
A successful-response average excludes callers who waited until their deadline or were rejected at admission. Track those outcomes separately so an apparent latency improvement cannot come solely from dropping the difficult requests. Keep service-class and task-category views, using real recorded counts rather than invented operational metrics.
When the arrival distribution changes, compare reservation estimates with actual usage. Persistent over-reservation can reduce useful capacity, while under-reservation can defeat the intended bound. Adjust the policy with evidence and preserve a conservative fallback for requests whose representation or output allowance cannot be estimated confidently.
Keep the rejection reason understandable to the application: forbidden destination, exhausted work allowance, unavailable concurrency and expired deadline require different handling. Combining them into one generic model failure encourages unnecessary retries.
Test the waiting request boundary
One short request finishes. Can the largest waiting prompt always enter?
Reveal the design reasoning
No. Check its full memory and execution demand, remaining deadline and fairness policy. Continuous batching changes scheduling opportunities, not the resource envelope.
Decision: Validate scheduler behavior under mixed shapes and actual state release.
Choose a destination and an admission outcome separately
An idle model is cheaper but cannot satisfy the required data-destination policy. Can the router use it?
No. Enforce eligibility before optimizing cost or latency. A classifier's confidence does not grant permission to send the input. Reject, defer or use another eligible route under the task contract.
A bucket has 1,000 work tokens left and a request needs 3,000. Does available concurrency make it fit?
No. The work reservation and concurrency are separate limits. Under the selected 2,000-per-second refill it can fit after one second only if no other work consumes that allowance and its deadline still permits waiting.
Arrival rate is 120 requests/s and service rate is 100 requests/s. Will a larger queue stabilize the service?
No. The selected backlog grows by 20 requests each second while the imbalance persists. Bound admission, reduce work, increase effective capacity or change the service contract. More waiting storage does not eliminate the overload.
Northwind decision log
- Enforce task and data eligibility before selecting among model routes.
- Reserve bounded work and cap outstanding requests under one deadline.
- Evaluate misroutes, starvation and accepted-task cost before changing traffic.
Go deeper: measuring and protecting capacity
- Video lecture: LISA '12 — Performance Analysis Methodology, Brendan Gregg, USENIX. Choose diagnostic signals before changing a service limit.
- Book chapter: The Art of Capacity Planning, chapter 2: Setting Goals for Capacity, John Allspaw. Define the workload and service expectations before admission.
- Book chapter: The Art of Capacity Planning, chapter 3: Measurement: Units of Capacity, John Allspaw. Choose resource units that explain demand and capacity.
- Primary document: Adaptive Concurrency, Envoy contributors. Inspect a concrete latency-based concurrency controller and its assumptions.
Check the mechanism in this lesson
Do five reusable slot-iterations prove that continuous batching will improve GPU throughput by a fixed percentage?
Compare the explanation
No. They describe openings in the supplied scheduling model. Actual memory growth, kernels, workload mix and admission overhead determine whether those openings translate into useful completed work.
Carry the decision forward
Northwind can reason about scheduling and KV allocation. Page 32 changes another resource term: weight representation, whose smaller payload must still have supported execution and acceptable task behavior.