How Does One GPU Serve Hundreds of Users at the Same Time?
From the publisher’s feed, collected in the ZeroLabs newsroom.
Inside an LLM inference serverTL;DRThe model weights are loaded into GPU memory once and shared by every request. Only the per-request state is duplicated.A request runs in two phases with opposite hardware behaviour: prefill is compute-bound, decode is memory-bandwidth-bound.During decode the GPU reads the entire model from memory to produce one token. Batching amortises that read across many requests, which is why it works so well.Continuous batching schedules at the token level instead of the request level, so finished requests leave and new ones join mid-flight.Concurrency is usually capped by KV cache memory, not by compute.Latency needs two numbers, not one: TTFT and TPOT. Raising batch size improves throughput and worsens both.A single GPU can serve hundreds of concurrent users against a model with tens of billions of parameters. That sounds implausible. The model is enormous, the GPU has one set of compute units, and every user expects a response streaming back within a second or two.The obvious approach — give each user their own GPU — fails immediately on arithmetic. A hundred concurrent users would mean a hundred copies of a model that might occupy 140 GB each. Nobody does this.What actually happens is that one copy of the model serves everyone, and a piece of software called the inference server works very hard to keep the GPU busy. This article is about how that software works: queues, schedulers, batching, and the specific reasons LLM inference is harder to schedule than almost any other workload.1. Three things that are easy to confuseWorth being precise about the vocabulary before going further, because these terms get used interchangeably and they are not the same thing.The model is the artifact: an architecture plus billions of learned parameters (weights). It does not run anything by itself.The inference engine is the component that executes the model on the GPU and manages memory, batching and scheduling. vLLM, TensorRT-LLM and SGLang are inference engines.The model server is the process that exposes the engine over the network — accepting HTTP requests, tokenizing input, streaming output back. In practice engines like vLLM ship with a server, so one process does both jobs.The model is what gets executed. The engine decides how and when it gets executed. The server turns that into a service.2. The key insight: weights are shared, state is notHere is the single fact that makes multi-user serving possible.The model weights are read-only during inference. Nothing about processing your request modifies them. So they are loaded into GPU memory once, and every concurrent request reads the same copy.What is per-request is much smaller: the tokens of the conversation, some position bookkeeping, and the KV cache — the attention state the model builds up as it processes your tokens, which lets it avoid recomputing everything on each generation step.So, the cost of an additional user is not “another model”. It is “another slice of KV cache”. That slice is small compared to the weights — but as we will see in Section 11, it is what ultimately caps concurrency.3. The path a request takes inside the serverTwo things are worth noticing about this diagram.First, the loop is not the whole request. Everything from the scheduler down runs again for every single token generated. A 500-token answer goes around that loop 500 times.Second, the scheduler runs before each pass, not once per request. That is the design decision the rest of this article hangs on4. Two phases, two completely different problemsInference is not prompt → answer. It runs in two phases, and they stress different parts of the hardware.Prefill processes the input prompt. If you send 5,000 tokens, all 5,000 are processed to build the initial attention state. Crucially, they can be processed together — token 4,000 does not need to wait for token 3,999, because the whole prompt is already known. That is a large, dense matrix operation with a lot of parallel work.Decode generates the answer one token at a time. Each token depends on every token before it, including the ones just generated. There is no way to compute token 10 before token 9 exists. Each step processes exactly one token position per sequence.PREFILL DECODE5,000 tokens at once 1 token at a time ████████████ █ ████████████ █ ████████████ █ lots of parallel work almost noneThis asymmetry is the source of nearly every difficulty in LLM serving.5. Why decode is slow, and why it is slow for a surprising reasonIntuitively you would guess decode is slow because generating text is hard work. That is not it. Decode is slow because of memory bandwidth.To produce one output token, the GPU must read the model’s weights out of VRAM and pass the token through them. All of them. Generating a single token from a 70B model in 16-bit precision means moving roughly 140 GB from memory into the compute units.Take a rough number for on-GPU memory bandwidth of around 3,000 GB/s:140 GB ÷ 3,000 GB/s ≈ 47 ms per token ≈ 21 tokens/secondThat is the ceiling for a single request, and it has nothing to do with how much arithmetic the GPU can do. The compute units are mostly idle, waiting for weights to arrive. Decode is memory-bandwidth-bound.Prefill is the opposite. It processes thousands of token positions against that same single weight read, so there is far more arithmetic per byte loaded. Prefill is compute-bound — it can actually saturate the GPU’s arithmetic units.Prefill vs Decode: Utilization ExplainedPrefill is limited by how fast the GPU can calculate. Decode is limited by how fast the GPU can read.6. Batching: the fix falls out of the previous sectionLook again at that 47 ms weight read. The GPU spent it fetching 140 GB of weights to serve one user’s token. The compute units were idle for most of it.So bring more users. If eight requests are all mid-generation, the server can process their next token in the same forward pass. The weights get read once, and that read now serves eight tokens instead of one.Throughput rises close to linearly for a while, and per-user latency barely moves, because the expensive part — the weight read — was already being paid for. This is why batching is not a minor optimization in LLM serving. It is the entire economic basis of it.The scaling is not free forever. Each additional sequence adds its own KV cache reads and attention work, so at some point the pass becomes genuinely compute- or memory-limited and per-token latency starts climbing. But the first stretch of that curve is close to free throughput, and every serving system is built to exploit it.7. Static batching, and why it failsThe simplest implementation collects requests until the batch is full, runs them together, and returns when all are done. This is static batching.It is a poor fit for LLM traffic for two reasons.Requests wait to start. With a batch size of eight, the seventh request sits idle until an eighth arrives. Latency depends on other people’s traffic.Requests wait to finish. Output lengths vary enormously — one user asks for a yes/no answer, another for a 2,000-word essay. In a static batch, everyone waits for the longest generation. Slots belonging to finished requests sit empty, doing nothing.Static batching (time →)A ████░░░░░░░░░░░░ done early, slot wastedB ████████░░░░░░░░ done, slot wastedC ████████████████ the stragglerD ██████░░░░░░░░░░ done, slot wasted ↑ batch releases only hereDynamic batching patches the first problem: launch when the batch is full or when a timeout expires, whichever comes first. That bounds the waiting-to-start cost. It does nothing about the second problem, which for LLMs is the bigger one.8. Continuous batching: schedule tokens, not requestsThe real fix is to stop treating a batch as a fixed group. Introduced as iteration-level scheduling in the Orca paper and now standard, continuous batching re-forms the batch before every single forward pass.A request that finishes leaves immediately, and a waiting request takes its slot on the very next step.Continuous batching (time →)A ██████B ████C ████████████D ██████████E ██████F ████Nothing waits for a batch boundary, because there are no batch boundaries. This is what “continuous”, “in-flight” and “iteration-level” batching all refer to — the same idea under different names.The gain is large precisely because output lengths vary so much. The more variance in generation length, the more slots static batching wastes and the more continuous batching recovers.Static vs Continuous Batching9. What the scheduler actually decidesGiven that the batch is rebuilt every step, the scheduler has a real decision to make each iteration. Roughly:Which waiting requests can be admitted — is there enough free KV cache memory to accept them?Should this step run prefill for a newly admitted request, or decode for requests already generating?If memory is exhausted, should a running request be preempted to free space?That last one is worth noting. When the KV cache fills up, the engine can evict a running sequence — either dropping its cached state (to be recomputed later) or swapping it out — and resume it once memory frees up. From the outside this looks like a request that suddenly stalls mid-generation.The first two decisions create a direct conflict, which is the subject of the next section.10. Prefill and decode fight each otherPrefill is a big, compute-hungry operation. Decode is a stream of small, latency-sensitive steps.Put them in the same engine and they interfere. When a request arrives with a 20,000-token prompt, running its prefill occupies the GPU for a noticeable stretch. Every user currently mid-generation sees their token stream pause for the duration.The result is a genuine trade-off:Prioritize prefill → new users get fast TTFT, existing users see stuttering output.Prioritize decode → existing users stream smoothly, new users wait longer for their first token.Chunked prefill is the standard mitigation. Instead of processing a 20,000-token prompt in one enormous step, the scheduler splits it into chunks and interleaves them with decode steps:Chunked SchedulingThis smooths inter-token latency for existing users at a small cost to the new request’s TTFT, and it lets a single batch contain both prefill and decode work — which keeps the compute units busier than pure decode ever could.The same tension, taken to its conclusion, leads some systems to run prefill and decode on entirely separate GPU pools. That is a topic for a later article.11. What actually limits concurrencyHere is where most intuitions are wrong. Ask an engineer what caps the number of concurrent users on a GPU and they will usually say compute. It is almost always KV cache memory.Recall the memory budget:VRAM = model weights + KV cache + runtime buffersThe weights are fixed. Whatever remains is the KV cache pool, and every active sequence draws from it in proportion to its context length.The consequence is that your maximum concurrency depends on how long your users’ conversations are. A deployment comfortably serving 200 concurrent requests at 1,000 tokens of context each may collapse to a fraction of that if those contexts grow to 32,000 tokens — the same GPU, the same model, the same compute, but the cache pool drained far faster.Context Length vs ConcurrencyThis is why “how many users can this GPU handle?” has no answer without a context length attached. And it is why the engine’s memory management — how the KV cache is allocated, blocked and reclaimed — has such a direct effect on serving capacity.Those mechanics get their own article; see Related reading.12. Measuring what users actually feelBecause generation is streamed, a single latency number is misleading. Three metrics matter.TTFT — Time To First Token. How long before anything appears on screen. Driven by queueing, admission and prefill. This is what determines whether the interface feels responsive.TPOT — Time Per Output Token. The average time to produce each subsequent token. Driven by decode. This determines how fast the answer reads out.ITL — Inter-Token Latency. The gap between individual streamed tokens. Closely related to TPOT, but it exposes variance — the stutters caused by other requests’ prefill work — which an average hides.Request │ └───────────────┐ first token ↑ TTFTtoken → token → token → token ↑ TPOT / ITLAlongside these sit the throughput measures: output tokens per second across the whole server, and requests per second.The metric that ties everything together is goodput: the rate of requests completed while meeting your latency targets. A server reporting excellent token throughput while every user waits eight seconds for a first token has high throughput and terrible goodput. Goodput is the number worth optimizing.13. The knob: throughput versus latencyAlmost every tuning decision in an inference server reduces to one trade-off, controlled by how many sequences the scheduler allows to run concurrently.Larger batches → more tokens per weight read → higher throughput, lower cost per token. But more sequences share each pass, so per-user TPOT rises, and more requests compete for KV cache, so queueing grows and TTFT rises.Smaller batches → snappier individual responses, worse GPU economics.throughput │ ╭────────── saturation │ ╭───╯ │ ╭───╯ │ ╭─╯ └─────────────────────── batch size ↑ latency stays flat ↑ latency climbsThroughput and Latency Knee AnalysisThe useful operating point is the knee: the largest batch size that still meets your TTFT and TPOT targets. That is a business decision as much as a technical one — an interactive chat product and an overnight batch summarisation job sit at opposite ends of this curve, on identical hardware.14. The knobs in practiceMost engines expose the same handful of controls. In vLLM’s naming:GPU memory utilization — what fraction of VRAM the engine may claim. Higher means a bigger KV cache pool and more concurrency; too high and you risk out-of-memory errors.Max sequences — the ceiling on concurrently running requests. Your direct handle on the trade-off in Section 13.Max model length — the longest context accepted. Caps how much cache any single request can consume, which protects everyone else.Chunked prefill size — how finely long prompts are split, trading a new request’s TTFT against existing users’ inter-token smoothness.There is no default configuration that is correct for all workloads, because the right answer depends on your prompt lengths, output lengths and latency targets.15. Why GPU utilization liesOne warning before closing. nvidia-smi reporting 95% utilization does not mean the GPU is doing 95% of the useful work it could.That figure reports whether any kernel was executing — not whether the compute units were doing anything worthwhile. A GPU in a pure decode loop, stalled on memory reads with most of its arithmetic capacity idle, will happily report near-100% utilization.That is exactly the condition batching is meant to fix. So a server showing high utilization and low token throughput is not a healthy server — it is a bandwidth-starved one, and the fix is a larger batch, not a bigger GPU. Judge an inference deployment on tokens per second and goodput, not on utilization.16. Putting it togetherTwo hundred users are talking to one GPU. What is actually happening?The model weights sit in VRAM, loaded once. The remaining memory is a KV cache pool, sliced among the active conversations.Requests arrive continuously. Each one is tokenized and queued. Before every forward pass the scheduler looks at what is waiting and what is running, admits what fits in memory, and assembles a batch — typically some decode steps plus a chunk of someone’s prefill.The GPU runs that pass. The weights are read once and produce one token for each of the sequences in the batch. Those tokens stream out to their respective users. Sequences that just finished release their cache slices; requests that were waiting take their place.Then it does it again, tens of times per second.No user has a GPU. No user has a copy of the model. Every user has a slice of memory and a seat in a batch that is rebuilt thousands of times a second.The next problemEverything in this article eventually came back to the same resource.Batching works because weights are shared. Concurrency is capped not by compute but by cache memory. The scheduler’s admission decision is a memory decision. Preemption happens when memory runs out. Capacity depends on context length, because context length is what consumes memory. The number of users a GPU can serve is, more than anything else, a question of how much KV cache fits and how efficiently it is used.Which means we have been treating the most important resource in the system as a black box. We have said the KV cache exists, that it grows with context, and that it is what runs out. We have not said how it is stored, how it is allocated when every sequence is a different length, what happens to the space when a request finishes, or which state gets thrown away first when the pool is full.Those answers determine, very directly, how many users fit on your hardware:How does an inference engine actually store, allocate and reclaim attention state — and why does that determine serving capacity?That takes us inside the KV cache itself.The series1. What really happens when you click ‘Send’ on ChatGPT — A journey through modern AI Infrastructure2. What Do You Do With a Model That’s Too Big for Your GPU? — Quantization, Sharding and Parallelism Explained3. How Does One GPU Serve Hundreds of Users at the Same Time? — Inside an LLM inference server4. The KV Cache Explained: Why Long Conversations Get Expensive — How LLMs remember context without recomputing everything (Next Article)5. Why Is Your LLM Recomputing the Same Prompt 1,000 Times a Day? — Prefix caching, radix trees and block hashing explained6. Why Traditional Load Balancing Breaks for LLMs — Building an LLM-aware router7. Kubernetes for LLM Inference: How AI Workloads Run Across a GPU Cluster8. LLM-D Explained — How modern AI infrastructure routes, schedules and scales LLM inference9. Inside a Modern AI Inference Platform — The full stack end-to-endSourcesvLLM documentationOrca: A Distributed Serving System for Transformer-Based Generative Models (OSDI ‘22)NVIDIA — Mastering LLM Techniques: Inference OptimizationModular — Static, dynamic and continuous batchingHow Does One GPU Serve Hundreds of Users at the Same Time? was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.