LLM Inference Compute Bottlenecks and KV Cache Scheduling Strategies
This article explains why GPU compute, not application logic or network bandwidth, ultimately caps how many users a chat-style LLM service can serve at peak. It breaks inference into the compute-bound Prefill stage and the memory-bound Decode stage, shows why Decode is gated by HBM bandwidth rather than floating-point throughput, and argues that the ephemeral nature of chat KV cache makes aggressive scheduling safe. It then covers continuous (dynamic) batching with a scheduling pseudocode example, and closes with practical guidance on capacity planning, TTFT/TPOT monitoring, elastic scaling, and overload protection.
1. Why Peak Concurrency Is Bounded by Compute
In online inference for conversational LLMs, one easily overlooked fact is that what really limits “how many users can be served simultaneously” is usually not application logic or network bandwidth, but the compute resources at the very bottom of the stack: the GPUs. When a model service announces that it is “short on compute and pausing new user onboarding,” it is essentially saying that the inference throughput it can sustainably deliver per unit of time has hit the ceiling, and admitting more requests would noticeably slow down response times for every user already online.
To understand this, start with the lifecycle of a single chat request. A user submits a prompt, and the server has to emit — token by token — every token of the reply. Generating one token is equivalent to running one complete forward pass over the model. In theory, as long as the GPUs keep producing tokens fast enough, the service can finish the current user quickly, release the resources that session holds, and move on to the next queued request. For this reason, the number of available GPUs directly determines how many sessions the system can maintain in parallel at peak load — which is the root cause of “compute is the concurrency ceiling.”
2. The Two Phases of Inference: Prefill and Decode
Modern LLM inference splits cleanly into two phases with very different compute characteristics, and understanding both is a prerequisite for understanding every bottleneck that follows.
- Prefill: the model processes all prompt tokens of the user’s input in a single parallel pass, computing their Key and Value tensors and writing them to cache. This phase is compute-bound. It can fully exploit the GPU’s arithmetic throughput, and it primarily affects time to first token (TTFT).
- Decode: the model generates output tokens one at a time, with only one position processed per step. This phase is memory-bound. The limit is not peak compute, but the fact that every single token requires moving the entire set of model weights and the accumulated KV cache from GPU memory to the compute units.
The “stuttering” that users perceive happens almost entirely during Decode. And since chat workloads are dominated by Decode, this is what determines the system’s real capacity.
3. The Memory Bandwidth Bottleneck in Decode
During Decode, the GPU’s arithmetic units are actually idle-starved for most of the time. The reason: generating each new token requires re-reading all model parameters plus the KV cache accumulated so far. The compute units sit waiting for data to be moved, so the true bottleneck is memory bandwidth, not floating-point throughput.
One important implication follows: a slightly smaller memory capacity will not immediately take the service down. Even when cache space is tight, as long as the system is good at “computing fast and freeing fast,” the next user’s request can be brought in and pushed forward quickly. This is precisely the foundation for capacity scheduling in chat scenarios.
4. Why KV Cache Can Be Dropped or Swapped Out
To understand scheduling strategies, you first need to recognize two distinctive properties of chat workloads:
- Single-turn sessions dominate. A large share of requests are one-off short queries — “what’s the weather tomorrow,” “what’s some obscure fact about X.” Users ask, get an answer, and leave, with no follow-up expected in the near term.
- Revisits to long sessions are infrequent. Even for genuinely multi-turn conversations, users rarely iterate on the same session back-to-back at very high frequency.
Given these two premises, a chatbot has a very favorable property: KV cache is ephemeral. When memory gets tight and space must be freed for new requests, the system can proactively preempt the KV cache of low-activity sessions. When that user starts a new conversation later, one of two fallback strategies kicks in:
- Swap-in restore: temporarily offload the KV cache to CPU memory or local SSD storage, then load it back into GPU memory when the user returns, giving a lossless continuation.
- Recompute: simply discard the cache, and when the user starts a new conversation, replay the history through Prefill from scratch — trading a bit of extra compute for memory headroom.
Both fallbacks have bounded, controllable cost, so a chat service can therefore schedule fairly aggressively in pursuit of high utilization rather than conservatively reserving memory for every session in the long term.
5. The Core Lever for Throughput: Dynamic Batching
Simply adding more GPUs raises throughput, but what actually determines efficiency per unit of compute is the batching strategy. Naive static batching requires every request in a batch to start and finish together, so requests of different lengths hold each other back. The approach widely used in production is continuous batching (also called dynamic batching):
After each decode iteration, the scheduler re-examines the batch — sessions that have finished generating exit immediately and release their resources, while queued requests dynamically fill the vacated slots. This keeps GPU memory and compute running at near-full load almost all the time, driving the “waiting” gaps down to a minimum.
The following illustrative pseudocode captures the core logic of this scheduling loop:
# Continuous batching scheduling loop (illustrative, not tied to a specific implementation)running = [] # sessions currently decodingwaiting = queue # queue of requests waiting to be admittedwhile waiting or running:# 1. Admit: take new requests first; if memory is short, preempt the KV cache of low-activity sessionswhile waiting and can_fit(running, waiting[0]):req = waiting.popleft()if not enough_memory():victim = select_low_activity(running) # pick a preemption targetoffload_kv(victim) # swap out to CPU/SSD, or drop and recompute laterrunning.remove(victim)running.append(req)# 2. One decode step: generate one token for the whole batch in parallelfor session in running:session.token = model.decode_step(session)if session.is_finished():free_kv(session) # release immediately on completion to free memoryrunning = [s for s in running if not s.is_finished()]
The core idea this logic expresses is that GPU memory is a scarce resource: whoever finishes first yields first, and cache is taken as needed and dropped when no longer needed. It reconciles the tension between “finite memory” and “a large number of concurrent requests” through dynamic scheduling and cache offload/recompute.
6. Capacity Planning and Engineering Practice
Once the mechanisms above are clear, a more pragmatic approach to capacity planning follows:
- Use throughput, not memory, as the capacity baseline. When assessing how much load a system can carry, focus on the sustainable token throughput per unit of time rather than something as simple as “number of GPUs × memory per GPU.”
- Govern metrics in layers. Monitor TTFT and per-token generation latency (TPOT) separately. Under heavy Prefill pressure, prioritize protecting TTFT; under heavy Decode pressure, smooth TPOT through batching and offload policies.
- Build elastic scaling. Use container platforms and elastic scheduling to add or remove inference instances automatically based on real-time concurrency and GPU utilization. In parallel, use monitoring and alerting to track key signals such as memory occupancy, batch length, and request queue depth, so you can scale out or throttle before thresholds are crossed.
- Define an explicit overload protection policy. When throughput approaches its limit, it is better to queue new requests or fail them fast than to let every online user slow down together — which is the engineering rationale behind “pausing new user onboarding.”
7. Summary
Phenomena like pausing membership enrollment are not purely product or operations decisions, but a rational form of protection under a hard compute constraint. The peak concurrency ceiling of a chatbot service is fundamentally determined by available GPU compute and memory bandwidth; the memory-bound nature of Decode in turn makes KV cache scheduling the key to efficiency. By using continuous batching to keep compute fully loaded, pairing it with a “disposable cache plus offload/recompute fallback” scheduling strategy, and adding elastic scaling with capacity monitoring, a service can reliably support as high a concurrent user count as possible within a limited compute budget. Understanding and making good use of this scheduling logic is a fundamental skill for any developer building high-concurrency LLM services.
