LLM Serving Under Capacity Pressure: How to Allocate and Schedule Inference Resources

    When online LLM inference traffic spikes, capacity—not model quality—is usually the first thing to break. This article explains where inference resource bottlenecks actually are, how different workload types differ in cost, and which practical strategies engineering teams can use to keep serving controlled when demand exceeds supply, including capacity planning methods and admission control techniques.

    1. The Problem

    When traffic to an online inference service rises sharply in a short period, the first symptom is rarely degraded model quality—it’s capacity. Requests start queuing, responses slow down, and new users may have to be turned away entirely. This is common across the industry because LLM inference consumes resources in fundamentally different ways from traditional web services. Understanding that difference is the prerequisite for designing scaling, rate-limiting, and quota policies.

    This article focuses on how inference services stay controllable when demand exceeds supply, addressing three questions: where the resource bottlenecks are, how much cost differs across workload types, and what engineering teams can do to reduce risk.

    2. Resource Bottlenecks in Inference Serving

    2.1 Concurrency Limits Are Set by Compute

    In conversational applications, the number of users that can be served simultaneously is primarily determined by the compute throughput of the accelerator (GPU). The model generates tokens one by one, and each token requires a forward pass. The higher the total token output per GPU per second, the more requests it can complete per unit of time.

    For example, if a request requires generating 1,000 tokens and the service can output 5,000 tokens per second, then in the ideal case that resource can complete the output of 5 such requests per second. Once request volume exceeds this rate, queue times grow continuously.

    2.2 The Decode Phase Is Memory-Bandwidth Bound

    Inference has two phases: prefill and decode. Prefill processes the input prompt and is compute-intensive. Decode generates output tokens one at a time, and each step reads model weights and cached data, making it mainly constrained by GPU memory bandwidth. When decode approaches the bandwidth limit, adding compute units does not meaningfully improve generation speed. A common engineering goal is therefore to keep the hardware running close to full utilization at the bandwidth bottleneck, rather than simply chasing peak compute.

    2.3 The KV Cache Lifecycle

    During generation, a Transformer caches the key-value vectors of every layer—this is the KV Cache. It avoids recomputing historical tokens, at the cost of occupying significant GPU memory. Memory capacity thus directly limits how many concurrent sessions can retain their state.

    The KV Cache has an important property: it is fundamentally a reconstructable intermediate result. As long as the original input is retained, the system can recompute it when needed. This means the server can swap the cache out to lower-tier storage while a session is idle, or discard it outright, and restore it when the user sends the next message. This trade-off converts memory pressure into latency and recomputation costs.

    3. Cost Differences Across Workload Types

    3.1 Single-Turn Q&A

    Single-turn Q&A typically has short inputs and medium-length outputs. Sessions are independent of each other and cache reuse is low. Providers can treat each request as a one-off task, releasing resources as soon as processing completes, so concurrency capacity is relatively high.

    3.2 Multi-Turn Long Conversations

    In multi-turn conversations, context grows with each turn. Every turn carries the full history, and if the cache has been dropped, the cost of restoring a long session grows with the length of that history. When users return to the same session multiple times in a day, cache hits become more valuable and keeping the cache yields greater benefit.

    3.3 Agents and Tool Calling

    A single agent task often involves multi-step planning, tool calls, result injection, and self-verification. One task may trigger dozens of model calls, each carrying long context. Adding extensible skill modules further increases input size. The compute consumption of this kind of workload can be several times that of ordinary Q&A.

    The table below summarizes the qualitative characteristics of the three workload types. Actual values depend on model size and deployment approach; the table is for horizontal comparison only.

    Dimension Single-Turn Q&A Multi-Turn Long Conversation Agent Tasks
    Input length per call Short Medium to long Long
    Output length per call Medium Medium Medium to long, with multiple calls
    Cache reuse rate Low Medium to high High
    Per-user resource footprint Low Medium High

    4. Capacity Planning

    The core of capacity planning is converting user counts into token demand, then aligning that with supply capacity. You can estimate as follows:

    1. Measure request volume per unit of time, along with average input and output lengths.
    2. Calculate total token demand, separating prefill from decode.
    3. Convert to the number of GPUs required using measured per-GPU throughput.
    4. Reserve headroom to handle traffic peaks and node failures.

    Here is a simplified estimation snippet; the example numbers only illustrate the calculation:

    1. import math
    2. def estimate_gpu_count(
    3. requests_per_minute: float,
    4. avg_output_tokens: float,
    5. tokens_per_second_per_gpu: float,
    6. headroom: float = 0.3,
    7. ) -> int:
    8. """Estimate the number of accelerators required.
    9. requests_per_minute: requests per minute
    10. avg_output_tokens: average output tokens per request
    11. tokens_per_second_per_gpu: measured output throughput per GPU (tokens/second)
    12. headroom: proportion of reserved headroom
    13. """
    14. if tokens_per_second_per_gpu <= 0:
    15. raise ValueError("throughput must be positive")
    16. demand_tps = requests_per_minute * avg_output_tokens / 60.0
    17. required = demand_tps / tokens_per_second_per_gpu
    18. return math.ceil(required * (1 + headroom))
    19. # Example: 600 requests per minute, average output of 500 tokens,
    20. # single-GPU throughput of 2000 tokens/second
    21. print(estimate_gpu_count(600, 500, 2000))

    In real planning, throughput figures should come from load testing, not theoretical peaks. The input length distribution, batch size, and time-to-first-token targets all affect the result, so estimates should be recalibrated regularly against production data.

    5. Strategies for Handling Demand Spikes

    5.1 Admission Control and Queuing

    Admission control is the most direct protective mechanism. The server maintains a concurrency cap; requests above the cap enter a bounded queue, and once the queue is full, new requests are explicitly rejected. The key is to return clear status to callers—such as an estimated wait time or a retry suggestion—rather than letting requests hang indefinitely.

    The following example shows a simple implementation based on a semaphore:

    1. import asyncio
    2. class AdmissionController:
    3. def __init__(self, max_concurrency: int, max_queue: int):
    4. self._sem = asyncio.Semaphore(max_concurrency)
    5. self._max_queue = max_queue
    6. self._waiting = 0
    7. async def acquire(self) -> bool:
    8. if self._waiting >= self._max_queue:
    9. return False # queue is full, reject immediately
    10. self._waiting += 1
    11. try:
    12. await self._sem.acquire()
    13. finally:
    14. self._waiting -= 1
    15. return True
    16. def release(self) -> None:
    17. self._sem.release()

    This implementation only works in a single-process scenario. In multi-instance deployments, the concurrency cap typically needs to be enforced centrally at the gateway layer or in a shared rate-limiting component.