How Do You Load-Test an LLM Inference Service in 2027?
Load-test an LLM inference service by driving it with realistic prompts at controlled concurrency and recording six numbers: time to first token (TTFT), inter-token latency (also called time per output token), end-to-end request latency, total output tokens per second, requests per second and the error rate. The first four are defined in NVIDIA's NIM benchmarking guide, and the guide warns that tools differ in how they compute them, so compare results only when definitions align.
The method is a sweep. Start at one concurrent request, raise concurrency in steps until the engine passes its maximum batch size, and plot total throughput against latency at each step. NVIDIA's guide says that if you have a latency budget, the matching point on that curve shows the highest throughput you can get within it, and the point where latency climbs with little throughput gain is where to stop.
Use a purpose-built tool such as AIPerf or vLLM's benchmark CLI for token-level timing, and a general load tool such as Grafana k6 or Locust when you need to test the whole stack in front of the model. Warm the service up first, keep the prompts realistic, and do not repeat identical prompts against a cache. The sections below cover each step and cite the docs behind it. This page quotes no benchmark results, because yours are the only ones that count.
The metrics that matter, defined
Definitions vary between tools, so fix them before you compare anything. These come from the NVIDIA NIM metrics page:
- Time to first token (TTFT). The time from query submission to the first received token. It generally includes request queuing time, prefill time and network latency, and longer prompts increase it because the model builds the KV cache from the full input first.
- End-to-end request latency. The time from submitting a query to receiving the full response, including queueing, batching and network latency. It equals TTFT plus the generation time.
- Inter-token latency (ITL), also called time per output token (TPOT). The average time between consecutive tokens. NVIDIA notes that tools differ on whether TTFT is included in the average; AIPerf excludes it. The vLLM benchmark output labels its time per output token as excluding the first token.
- Tokens per second. Total output token throughput across all simultaneous requests. It rises with load until the GPU compute is saturated and can fall after that. Per-user tokens per second, by contrast, falls as concurrency rises.
- Requests per second. The average number of requests the system completes successfully in a one-second period.
- Error rate. Not a latency metric, but count failed and timed-out requests separately. NVIDIA's definition of requests per second counts only successful completions, so errors silently lower it. vLLM's benchmark output reports successful requests for the same reason.
Report percentiles, not just averages. The vLLM benchmark prints mean, median and P99 for TTFT, time per output token and inter-token latency, and your service-level objectives should be written against the tail.
Choose realistic prompts, output lengths and concurrency
NVIDIA's parameters guide says your use case sets the input and output sequence lengths: longer inputs raise prefill memory use and TTFT, and longer outputs raise generation memory use and inter-token latency. It gives typical shapes:
- TranslationSimilar input and output length, typically 500 to 2,000 tokens each
- GenerationOutput near 1,000 tokens, input near 100 tokens
- SummarizationInput near 1,000 tokens, output near 100 tokens
If you have production traffic, the same guide says you can use real prompts as inputs. That beats synthetic text, because your real mix of lengths and shared prefixes drives both batching and cache behavior.
For load control, the guide defines concurrency as the number of concurrent clients, each with one active request, and request rate as the rate at which new requests are sent. It prefers concurrency for most benchmarks, because with a fixed request rate, outstanding requests can grow without bound when arrivals exceed throughput. It advises sweeping from one request to a value slightly above the engine's maximum batch size. Past that point requests queue, so TTFT rises while throughput levels off. Use request rate when you want to mimic arrivals from many independent users; vLLM's benchmark can send them as a Poisson process, with a burstiness setting to make traffic spikier.
For synthetic runs, NVIDIA also recommends setting `ignore_eos` to true so every request generates up to its token limit, and keeping the sampling method the same across a benchmark so runs stay comparable.
The tools: AIPerf, vLLM, LLMPerf, k6 and Locust
- AIPerf. NVIDIA's client-side generative AI benchmarking tool. Per NVIDIA's quickstart it reports TTFT, ITL, TPS and RPS against any OpenAI-compatible service. It replaces GenAI-Perf: the GenAI-Perf README says it is being phased out and points new work to AIPerf.
- vLLM benchmark CLI. `vllm bench serve` is built for the vLLM server but takes a dataset path and prints throughput and latency percentiles. The same page recommends GuideLLM for benchmarking production vLLM servers, because it is more flexible on datasets, request formats and workload patterns.
- LLMPerf. A Ray project whose load test spawns concurrent requests and measures inter-token latency and generation throughput. Its repository was archived by the owner on December 17, 2025 and is read-only, so treat it as a reference rather than a first choice.
- Grafana k6. An open-source performance testing tool. The NVIDIA metrics page notes that traditional web benchmarking tools such as k6 can report TTFT by using timing events in the HTTP request, which makes k6 useful for testing the gateway, auth and network path in front of the model.
- Locust. An open-source load testing tool where you write the test in regular Python and watch throughput, response times and errors in a web UI or export them. Good when your traffic is a scripted user journey rather than a single endpoint.
As a rule, use an LLM-aware tool when the question is how the model server behaves, and a general tool when the question is how the whole service behaves. NVIDIA suggests running AIPerf on the same host as the server to avoid network latency, unless you intentionally want network effects in the measurement.
The official examples show the shape of a run. NVIDIA's quickstart calls `aiperf profile` with a streaming chat endpoint, a mean input length, an output length, a concurrency and a request count. vLLM's page starts with `vllm serve <model>` and then `vllm bench serve` with a backend, endpoint, dataset and prompt count. Copy the exact flags from those pages, because they change between releases.
A step-by-step test plan: smoke, ramp, soak, spike
Grafana's k6 test-types guide gives a useful vocabulary: smoke tests check that the script works under minimal load, average-load tests check expected normal conditions, stress tests push beyond average, soak tests check reliability over extended periods, spike tests check survival under sudden, short, massive increases, and breakpoint tests raise load gradually to find capacity limits. Mapped to an LLM service:
- Smoke. Send a handful of requests to prove the endpoint, tokenizer, streaming and your measurement script all work.
- Warm up. NVIDIA's quickstart runs a warm-up load test before the full sweep. Discard it, or configure the tool's warm-up phase, which AIPerf excludes from throughput.
- Ramp (breakpoint). Sweep concurrency step by step. NVIDIA's example sweeps 1, 2, 5, 10, 50, 100 and 250 and sends three times the concurrency in requests at each step for a stable measurement. Do it for each input and output shape you care about, then plot throughput against TTFT.
- Steady state at your target. Pick the concurrency that stays within your latency budget and hold it, recording percentiles and errors.
- Soak. Hold that load for an extended period to catch problems that short runs miss, such as memory growth or slow degradation, as the k6 guide describes for soak tests.
- Spike. Jump suddenly to a multiple of normal load and see whether the service queues, sheds load or fails, and how long it takes to recover. If you use request rate, vLLM's burstiness setting shapes how uneven arrivals are.
Interpret the results and set SLOs
NVIDIA's quickstart explains the central chart: TTFT on one axis, total system throughput on the other, one point per concurrency. Two readings follow from it. With a latency budget, take the maximum acceptable TTFT, and the matching point gives the highest throughput you can reach inside it. With a target concurrency, find that point and read off both latency and throughput. The chart also exposes concurrencies where latency grows quickly with little or no throughput gain; stay below them. Similar charts can use inter-token latency, end-to-end latency or per-user tokens per second as the latency axis.
Turn the curve into service-level objectives by writing them against the metrics users feel. TTFT governs how fast a streamed answer starts, inter-token latency governs how smoothly it reads, and end-to-end latency matters for non-streaming and agent calls. State each as a percentile, such as P99, at a named concurrency and prompt shape. Because queueing begins once concurrency exceeds batch capacity, set the autoscaling trigger below that point rather than at it.
Cost per million tokens, as a method
Cost per million tokens is arithmetic on your own measurements, not a number to copy from a vendor. The method:
- Pick the operating point. Use the concurrency from your curve that stays inside your latency objectives, not the peak-throughput point.
- Read sustained output tokens per second there. This is the total output token throughput as NVIDIA defines it, across all simultaneous requests, measured with warm-up excluded.
- Convert to tokens per hour. Multiply sustained tokens per second by the seconds in an hour.
- Divide the hourly price of the serving hardware by tokens per hour. That is cost per token. Multiply by one million for the usual unit. Use the all-in hourly price for the replica or node that produced the throughput.
- Treat input and output separately if you price them separately. Prefill and decode stress the system differently, so run the sweep with your real input-to-output mix and keep the ratio when you quote a blended figure.
Common pitfalls
- Skipping warm-up. NVIDIA runs a warm-up load test before its sweep for a reason. Cold starts distort the first measurements.
- Letting the prefix cache flatter you. vLLM's benchmark page warns that repeating `vllm bench serve` against the same server can reuse prompts left in the prefix cache and inflate throughput. Automatic prefix caching lets a new query skip computing a shared prefix. That is real in production when prompts share a prefix, so test with and without it, deliberately.
- Mixing streaming and non-streaming. TTFT and inter-token latency only exist when you stream. NVIDIA's examples use a streaming endpoint, and vLLM's tool has a flag to turn streaming off. Match the mode your clients use.
- Stopping early on short outputs. If the model emits an end-of-sequence token early, outputs are shorter than planned. NVIDIA recommends `ignore_eos` for benchmarks to reach the intended length.
- Comparing unlike definitions. Whether inter-token latency includes the first token varies by tool, so check the definition before comparing numbers across tools.
- Running the client far from the server. Network latency becomes part of the numbers unless you meant to measure it.
Questions people ask
Which metrics should I report from an LLM load test?
Report time to first token, inter-token latency (time per output token), end-to-end latency, total output tokens per second, requests per second and error rate, with percentiles such as P99 rather than only averages. The first five are defined in NVIDIA's metrics guide and printed by vLLM's benchmark.
Is GenAI-Perf still the tool to use?
No for new work. The GenAI-Perf README says it is being phased out and tells users to use AIPerf for new benchmarking needs.
Should I control concurrency or request rate?
NVIDIA's parameters guide prefers concurrency for most benchmarks, because with request rate the number of outstanding requests can grow without bound when arrivals exceed throughput. Use request rate when you specifically want to model independent arrivals.
Can I load-test an LLM service with k6 or Locust?
Yes, for the stack around the model. NVIDIA notes that k6 can provide TTFT through timing events in the HTTP request, and Locust lets you script tests in Python. For per-token timing and sequence-length control, an LLM-aware tool is easier.
How long should a soak test run?
The k6 guide describes soak tests as assessing reliability and performance over extended periods and gives no single duration. Choose one long enough to cover your real traffic cycle and any slow degradation you want to catch.
How do I calculate cost per million tokens?
Divide the hourly price of the serving hardware by the output tokens per hour sustained at a concurrency that meets your latency objectives, then multiply by one million. Use warmed-up, cache-aware measurements from your own sweep.
Sources
- NVIDIA NIM Benchmarking: Metrics · definitions of TTFT, end-to-end latency, ITL, tokens per second and requests per second
- NVIDIA NIM Benchmarking: Parameters and Best Practices · sequence lengths, concurrency, request rate, ignore_eos
- NVIDIA NIM Benchmarking: Using AIPerf to Benchmark · warm-up, concurrency sweep and how to read the latency-throughput plot
- AIPerf (GitHub) · NVIDIA's generative AI benchmarking tool
- GenAI-Perf README (GitHub) · notice that GenAI-Perf is being phased out in favor of AIPerf
- vLLM Benchmark CLI · vllm bench serve, load patterns, metrics output, prefix-cache warning
- vLLM Automatic Prefix Caching · how shared prefixes skip computation
- GuideLLM (GitHub) · benchmarking framework recommended by vLLM for production servers
- LLMPerf (GitHub) · Ray load-test library, archived December 17, 2025
- Grafana k6 documentation · open-source load testing tool
- Grafana k6: Load test types · smoke, average-load, stress, soak, spike and breakpoint tests
- Locust documentation · Python-scripted load testing
Tools and flags change quickly. This page was written from the linked official documentation on October 18, 2026; check the current pages before you script a test, and trust your own measurements over anyone's published numbers.