Benchmark vLLM
Measure a vLLM server directly and explain its latency with KV cache, queue and preemption metrics.
Prerequisites
Section titled “Prerequisites”- A vLLM endpoint reachable from bench.
- Prometheus scraping vLLM about every 5 seconds.
- For snapshots, its namespace listed in
rbac.bench.targetNamespaces.
Configure the target
Section titled “Configure the target”apiVersion: servtuner.dev/v1kind: RunSpecname: vllm-baselineexperiment: vllm-max-num-seqsknobs: vllm.max_num_seqs: 128target: type: vllm endpoint: https://vllm.inference.svc:8000/v1 model: example/model auth: secretRef: { name: vllm-key, key: token } workload: namespace: inference selector: { app: vllm } tls: mode: mtls secretRef: { name: servtuner-client }engine: { type: loadgen }workload: preset: chat-short@1 streaming: trueload: pacing: poisson warmup: 30s stages: - { rate: 4, duration: 180s } - { rate: 8, duration: 180s } - { rate: 16, duration: 180s }slos: { ttft_p95: 500ms, itl_p95: 50ms }prometheus: url: https://prometheus.monitoring.svc:9090 tls: mode: mtls secretRef: { name: servtuner-client }For a vLLM outside Kubernetes, use target.metrics instead of target.workload. It names the labels your scrape job attaches. See off-cluster targets.
Run it
Section titled “Run it”Submit the file in New run, or run servtuner run --spec vllm.yaml. Keep warmup requests separate from the first stage, and use stages long enough for your percentiles.
Set these on a vLLM you benchmark:
--stream-interval 1. A larger value sends several tokens per chunk, so inter-token latency measures chunks. servtuner grades such a run degraded.- Leave statistics logging on.
--disable-log-statsremoves the Prometheus metrics. - Finer
--custom-histogram-buckets, if you need server-side latencies under 0.3 seconds.
Read the advisor
Section titled “Read the advisor”| Rule | What it looks for |
|---|---|
| V1 | Running requests pinned at max_num_seqs with KV cache to spare |
| V2 | KV cache full, or preemptions |
| V3 | max_model_len far above the observed lengths |
| V4, V5 | TTFT or ITL over its SLO from prefill or decode pressure |
| V6 | Prefix cache hits lower than the workload should give |
| V7 | The API server bound by CPU while the GPU is idle |
| V8 | GPU memory growing above vLLM’s reservation |
| V9 | An under-used GPU with no vLLM cause |
| V10 | Server percentiles inside the first histogram bucket |
| V11 | Requests refused by vLLM’s admission limits |
| V12 | Logging options that cost CPU or remove metrics |
A single run gives a hypothesis. Confirm it with a follow-up or an experiment.
Verify
Section titled “Verify”On the run’s Config tab, check that declared knobs match captured knobs. A mismatch excludes the run from comparisons, because the target did not run what you declared.
Next steps
Section titled “Next steps”Compare values in an experiment, or let servtuner search with a tuning session.