BlogInfrastructure
Planning GPU capacity for a model your team serves
You need enough replicas to carry peak traffic at your latency target with one replica out of service, and no more than that during the hours when traffic is low. The number that matters is how many requests per second one replica sustains on your own prompts while time to first token and generation speed stay within target. Measure that, divide your peak by it, add headroom, then decide what happens off-peak. GPUs sit idle when a fleet sized for Monday morning runs unchanged through Sunday night.
What limits a single replica
GPU memory holds the model weights and the KV cache, which grows with the context length and number of sequences in flight. Once weights are loaded, the KV cache sets how many requests a replica can batch, and batching sets throughput. The PagedAttention paper behind vLLM showed that wasted KV cache memory had been limiting batch sizes, and that managing it in pages raised throughput at the same latency.
In vLLM, gpu_memory_utilization decides how much memory the instance takes, 0.92 by default in the current documentation, and max_model_len and max_num_seqs cap context and concurrency. When the KV cache runs out, vLLM preempts requests and recomputes them, which its documentation warns can hurt latency. Quantised weights or a smaller KV cache data type free memory for more concurrent requests, at a quality cost you have to test.
Describe the workload before you benchmark
A benchmark on synthetic prompts of fixed length answers a question nobody asked. Before measuring, write down:
- Arrivals per second by hour and weekday, with the busiest five minutes rather than the hourly average
- The distribution of input and output tokens per request, because a few long requests consume a large share of the KV cache
- Latency targets per feature, such as p95 time to first token and time per output token
- Which work is interactive and which can wait, such as overnight document processing
Benchmark one replica at your latency target
vLLM's serving benchmark can replay a custom dataset of your prompts at a chosen request rate, with adjustable burstiness and an optional concurrency cap, and report goodput: the requests that met the time-to-first-token, per-token and end-to-end targets you set. Step the rate up until goodput falls below the share you need. That rate is the replica's capacity for this workload. The offline throughput benchmark answers a different question, maximum tokens per second with no latency target, which is useful for sizing batch jobs.
While the benchmark runs, watch the server's own metrics, but treat them as clues. Rising queue time with KV cache usage near full suggests memory pressure, and slowing generation with cache to spare suggests compute, yet both can occur together and scheduler settings affect each. Before naming the limit, check preemption counts, GPU compute and memory-bandwidth utilisation and the number of running requests, then rerun with controlled changes to concurrency and context length to see which one moves the result.
From one replica to a fleet: a worked example
All figures here are hypothetical. An internal assistant peaks at 18 requests per second on weekday mornings and drops to 2 at night and on weekends. On real prompts, one single-GPU replica keeps 99 percent goodput up to 5 requests per second; at 6, queue time pushes goodput to 93 percent.
- 1
Peak replicas
18 divided by 5 is 3.6, so 4 replicas carry the peak.
- 2
Failure headroom
One more replica covers a failed node or a rolling deployment, making 5.
- 3
Quiet hours
At 2 requests per second, 1 replica suffices, plus 1 spare.
- 4
Compare schedules
Five replicas around the clock use about 3,650 GPU hours a month. Five for 12 hours on 22 weekdays and 2 for the remaining hours use about 2,250, roughly 38 percent fewer.
The schedule only works if replicas are ready before the morning ramp. Loading a model is not instant, so scale up on a timetable rather than waiting for queues to grow. vLLM documents ways to shorten repeated boots, such as reusing its compile cache. Overnight batch work can then run on the spare replica instead of a separate fleet.
Decide what absorbs traffic above plan
No plan covers every spike. Choose in advance between three options. A bounded queue keeps latency predictable and rejects excess load early. A hosted model as overflow keeps answers flowing, provided it passed the same quality tests and your data rules allow it. Deferring non-urgent work moves batch jobs out of the peak. Each choice has a cost, and agreeing it before launch prevents the reflex of buying GPUs for a spike that happens twice a year.
Questions
Should we size from the GPU vendor's throughput figures?
Use them to shortlist hardware, not to size. Published numbers rarely match your prompt lengths, output lengths, model and latency target, and any of those can change capacity several times over. Benchmark one replica on your own traffic.
When should we rerun the capacity benchmark?
After any change to the model, its quantisation, the vLLM version or key settings, and when prompt or output lengths shift noticeably, for example after a new feature adds retrieved context. Keep the benchmark dataset versioned with the results.
Can Cloudsail run this for our model?
Yes. We benchmark with your platform team in your cloud account, on your prompts, and leave the benchmark scripts, results and the scaling schedule with your team.
More from the blog
LLM latency budget
How to find out why an AI feature is slow: split each request into queueing, retrieval, model and tool spans, then fix the largest one you can change and measure the tail under load.
Quantisation quality checks
Which tests to rerun before a quantised model replaces the original: task quality, structured output, long inputs, behaviour checks and serving performance, with cost compared per GPU.
Small model task selection
How to find the high-volume tasks a small language model can handle reliably: a screening checklist, a test before any training and a cost comparison at your own volume.
Talk to an engineer
Bring one piece of work you would like to improve. The call takes 30 minutes and needs no access to your systems or your data.
Booking runs on Google Calendar.
Prefer to write first? Leave your email and a few lines, and we reply with times.
Look for the draft in your email program
Send it from there, and an engineer replies in person with times for a 30-minute call. If no draft has opened, write to us at miki@cloudsail.com.