How My Load Generator and vLLM's API Server Limited an H100 Benchmark
The last post ended on a discrepancy. In one round, my load generator recorded a pause longer than 200 ms in 1,689 of its 2,048 requests. vLLM’s own histogram of the time between tokens showed no gap that long. The run passed my load check. Those were real gaps between reads in my client, and they were not the card. They were mine first, and after I fixed mine, vLLM’s API server was next in line.
GPU · one NVIDIA H100 80 GB
Engine · vLLM 0.31.0
Model · Qwen/Qwen3-8B, BF16
Workload · 200-token prompt, 256-token output, 256 clients, prefix caching off
Load generator · closed loop, each client keeps one request in flight
Runs · the short-prompt round from the first post; the same round on a second pod with a new load generator; four rounds on a third pod for the API server, with a token budget of 4,096 instead of 2,048
Data · raw data and scripts will be published in a public repository after this series; this post will link to it then
The engine was smooth, the client was not
Two clocks watched the same stream. vLLM times the gap between two tokens of a request inside the engine. My load generator times the gap between two chunks as it reads them from the socket. The second clock includes everything after the engine: the API server, the loopback connection and my own code.
Inside the engine nothing was wrong. At the client, the longest pause in a typical request was about a quarter of a second. The stream was not slower on average, it was lumpy: tokens arrived in bursts, with a median gap of 0.06 ms between two chunks, far less than one engine step. Something was holding tokens back and then releasing them together.
The load fell after every wave
A closed-loop client is supposed to keep the load constant: 256 clients, 256 requests in flight. I plotted how many requests my clients had in flight, ten times a second, next to what the server said it was running.
After every wave the client’s line fell, at worst from 256 to 13. Over the whole window it still held 95.8% of its load on average. That number sounds close to full, and it is the same run as the chart above.
The time from the end of one request to the send of the next had a median of 202 ms. With the long prompt of the first post it was 2.6 ms.
The waves themselves are a product of my load. Every client starts at the same moment and every reply has the same length, so requests finish together. Real traffic is not synchronized like that, and I have not measured unsynchronized traffic.
My load check passed because it asked the wrong question. It checked whether the client reached its load, by comparing the peak number of running and waiting requests with the client count. What mattered was whether the client held that load, and it did not.
256 threads, one interpreter
The load generator was one Python process with one thread per client. When a wave of up to 256 requests ended, every thread had the same things to do at once: finish reading, write a result row, send the next request.
The delay tracked the size of the wave. After a quiet half second, with at most 8 completions, the median turnaround was 25 ms. After a busy one it was around 200 ms. CPU load alone did not cause it: in another round the client was just as busy, but completions arrived evenly and the turnaround stayed under 3 ms.
I assume the cause is the interpreter lock, which lets one thread per process run Python code at a time. I did not observe the lock itself. What the measurements show is narrower: many threads in one interpreter, all needing it at the same instant.
A parent and its children
I kept the client and changed how it runs.
For more than 32 clients, a parent now starts one process per 32 clients, eight of them at 256. The parent hands out request slots, gives the start signal and is the only writer of the results. The children start before the load phase and wait for that signal, so their startup is not in the measured time. Before each level every child has to prove it reads the same clock as the parent, or the run stops before the first request.
The code that sends a request, reads the stream and takes the timestamps is untouched. That was the condition: the new client had to measure the same thing as the old one.
Before the next GPU runs, I tested both load generators against the same stand-in server with synchronized completions. In four runs on two pods the old one fell between 7% and 26% short of its load. The new one fell about 0.1% short.
Same engine, different client
I ran the short-prompt round again on a second pod, with the same server flags and the new load generator.
The median turnaround went from 202 ms to 0.48 ms. The engine recorded 190 gaps above 100 ms in each run. On the client side, requests with a gap above 200 ms went from 1,689 to zero. The median gap between two chunks at the client is now 13 ms, about one engine step.
Throughput moved much less. Steady-state output rose from 13,772 to 14,033 tok/s, about 2%. So the old client made a large error in what a caller would see and a small error in the headline number. A benchmark that reports only tokens per second would have hidden it.
It had hidden one more thing. With the client holding its load, the larger token budget from the first post costs about 1.6% of output on short prompts, in one run each. With the old client the two budgets looked the same.
A check that would have caught it
The load check changed too. A run is now invalid unless the client held at least 99% of its load over the steady-state window. Applied to the runs I already had, it fails the two short-prompt rounds and one level of the first post’s sweep.
That matters for the first post. The 512-client level of its sweep held 98% of its load and fails the new check. The sweep still shows about 9,000 tok/s at both 256 and 768 clients, and a repeat at 512 clients on the follow-up pod held its load and gave about the same output.
The engine still ran short of requests
The load chart from the new run has a second line, and that one still dips. The client now holds its 256 requests, but after a wave the server’s count of running and waiting requests still falls, and about 5% of engine steps ran with fewer than half the clients.
Those requests were in flight at the client and not counted by the engine: either not yet handed to it, or finished there and still being streamed out. Before blaming anything, I checked what else sits between the client and the card:
- the container used about 3 of its 24 cores and was never throttled;
- the KV cache was about a fifth full, with no preemptions;
- the engine’s own thread ran at about half a core.
The card itself was at its power limit through the run, as in the first post. Where were the requests the client counted and the engine didn’t? More of the first-token wait fell outside the engine, and the API server’s main thread was at 99% of a core at the 95th percentile. That pointed at the process in between.
One API server process, then two
By default vLLM puts one API server process in front of the engine. Its main thread handles HTTP, the per-token output and the streaming; a renderer thread applies the chat template and tokenizes. When a wave turns over, that one process has the last chunks of 256 requests to send and the next 256 to take in. My load generator adds to that: it opens a new connection for every request, so the process also has 256 connections to accept. A client with keep-alive, the HTTP/1.1 default, would not add them, and a measurement on my Mac with the same HTTP stack put their cost low enough that I spent the GPU time on vLLM’s flags instead.
vLLM 0.31.0 has two flags that could help, and I tried them one at a time on a third pod. These rounds used a token budget of 4,096, so their numbers compare with each other, not with the sections above. Each flag ran once. The baseline ran twice on this pod and once on the pod before, and its output moved by less than 1%.
The obvious first candidate was the renderer. By default one thread applies the chat template and tokenizes, and every wave hands it 256 prompts at once, so I expected four threads to take the requests in faster.
| output, tok/s | time to first token, p50 | time per output token, p50 | |
|---|---|---|---|
| baseline | 13,908 | 630 ms | 16.1 ms |
--renderer-num-workers 4 |
13,730 | 762 ms | 16.0 ms |
They did not. Time to first token got worse, and the API server’s main thread was busier with them, at a median of 96% of a core against 81%.
The likely reason they brought no gain is the prompt length. A 200-token prompt leaves little work per request to spread across threads, and where more renderer threads have been reported to help, the prompts were around 100,000 tokens.
The second candidate was the process itself. --api-server-count 2 starts two API server processes in front of the same engine, each with its own main thread, so I expected the work at a wave to split between them.
The dips got smaller. They did not go away, and one sample decides how deep each one looks, so these two charts show a direction, not a size.
The table gives the size.
| output, tok/s | time to first token, p50 | time per output token, p50 | |
|---|---|---|---|
| baseline | 13,908 | 630 ms | 16.1 ms |
--api-server-count 2 |
14,382 | 368 ms | 17.0 ms |
| baseline, repeated | 13,827 | 674 ms | 16.0 ms |
With two API server processes, median time to first token fell from 630 ms to 368 ms, far more than the repeat of the baseline moved. Output rose about 3%, while median time per output token rose about 6%. The records do not show why it rose.
Taken together, the median response finished only about 2% sooner. The first token came much earlier, and every token after it a little later.
What I changed in how I measure
- A run fails unless the load generator held 99% of its load.
- The load generator is tested against a stand-in server, without a GPU, before any GPU time is spent.
- The engine’s clock and the client’s clock go on the same chart. When they disagree, the problem is somewhere between them.
The next post leaves the single card: two H100s, and what sits between them.
Appendix: How I measured
- Turnaround: the time from the end of one request of a client to the send of its next one. In that time the client reads nothing from the server, so it is client time.
- Load held: the time-weighted number of requests the client has in flight over the steady-state window, divided by the number of clients.
- Engine gaps: vLLM’s inter-token latency histogram, timed inside the engine. A percentile from a histogram is known only to its bucket, so the chart shows the upper edge of that bucket.
- Client gaps: the time between two content chunks of a request as the load generator reads them.
- Connections: each request opens a new TCP connection and closes it when the stream ends, and connecting counts toward time to first token.
- Stand-in server: streams in vLLM’s format in fixed steps of 15.5 ms, with no model behind it, finishes all requests of a step together and logs when it sent each chunk. At 256 clients: three runs per load generator on one pod and one on the next, each before vLLM was started. Where the old generator kept up, both reported the same times to within one step. On a Mac, with 1,024 clients and all threads in one process, the new code fell about a third short of its load, like the old one.
- Server flags:
--max-num-batched-tokens 2048for the load generator rounds and4096for the API server rounds;--renderer-num-workers 4and--api-server-count 2as named in the tables. - With two API server processes vLLM writes no per-step log, and its running and waiting counts come from a multi-process metrics endpoint. I read that configuration from throughput and latency.