Skip to content

Throughput vs Latency: Match the Knobs to the SLA

On the same card and model, one operator posts a great average TPS and users still complain; another posts a modest TPS and the experience is smooth. The difference is not hardware, it is whether the SLA was fixed first and the parameters worked back from it.

This article avoids abstract theory and covers four hands-on knobs: max-num-seqs, max-num-batched-tokens, gpu-memory-utilization and --enable-chunked-prefill (semantics per the vLLM documentation). Each says which stage it moves, how to verify it and when to roll back. It ends with concrete values for three SLA classes.

Set the Standard First: goodput, Not TPS

TPS (tokens per second) counts every token the GPU emits, with no regard for whether the token arrived inside the SLA. A 32-way batch can post a high TPS while the last requests waited seconds — those requests are a failure from the user's point of view, yet they are counted in TPS.

The metric that tracks an SLO better is goodput: throughput counting only requests that met the latency target (say p99 under 2s, time-to-first-token under 500ms). A configuration is judged by goodput, not peak TPS. Every knob below targets the same goal: maximize goodput within the latency red line.

What Each Knob Moves

Knob one: max-num-seqs (concurrency cap)

It caps the active sequences per scheduling step. Raise it and more requests share a step, lifting throughput, but each waits longer and p99 climbs; lower it and latency improves at the cost of idle GPU.

Verify by starting conservatively and sweeping concurrency (1/4/8/16/32), plotting p99, finding where it just touches the SLA, then leaving 20 to 30 percent headroom. Do not jump to the maximum: under memory pressure it triggers preemption, and recomputing evicted sequences is slower.

Knob two: max-num-batched-tokens (per-batch token budget)

It sets the maximum tokens in one forward pass and is the chunking unit for chunked prefill. Raise it and a batch fills the GPU better, but a long prompt can consume the whole budget and block short requests; lower it and short requests are fairer while small batches lose utilization.

It pairs with chunked prefill: with --enable-chunked-prefill, long prompts are split by this budget and interleaved with decode requests. For long-prompt traffic, enable it and pick a granularity that stops a single prefill from eating the entire batch.

Knob three: gpu-memory-utilization (memory share)

Default 0.9, the share of GPU memory given to the model executor; the rest goes to KV cache and system overhead. The counter-intuitive part: higher can mean less concurrency. At 0.98 the KV cache pool is squeezed, fewer sequences fit and OOM becomes likely; too low and weights and activations are underused.

First leave enough KV cache space, then see how much concurrency fits. It must be tuned with max-num-seqs: the memory share sizes the KV cache pool, and the pool size decides the concurrency ceiling.

Knob four: KV cache dtype (buy concurrency with precision)

--kv-cache-dtype fp8 halves the per-token KV cache footprint, fitting more concurrent sequences in the same memory, at the cost of precision (acceptable for most generation tasks, but measure it for numerically sensitive ones). It is not a latency knob; it is a "buy concurrency at fixed memory" knob, most valuable when the bottleneck is KV cache space rather than compute.

Values for Three SLA Classes (Built from Typical Production Scenarios)

SLA A: interactive chat (p99 < 2s, TTFT < 500ms)
  |-- max-num-seqs: mid-to-low, leave queueing headroom
  |-- max-num-batched-tokens: mid value + --enable-chunked-prefill
  |-- gpu-memory-utilization: 0.9 default, confirm KV cache is enough
  `-- goal: hit p99 first, throughput second

SLA B: offline batch (throughput first, no strict p99)
  |-- max-num-seqs: raise to the memory-allowed ceiling
  |-- max-num-batched-tokens: raise to fill the GPU
  |-- gpu-memory-utilization: 0.92-0.95, still leaving OOM headroom
  `-- goal: maximize TPS, queueing does not matter

SLA C: mixed traffic (online and offline on one card)
  `-- do not co-locate in one instance: split into two deployments, each tuned
      (online for latency, offline for throughput), route traffic at the gateway

A Repeatable Verification Flow

1. Pin: model / dtype / input-output length distribution / concurrency steps
2. Change one knob at a time, rerun the same load test
3. Record each round: p50 / p99 / TTFT / goodput / KV cache use / preemptions
4. Plot p99 vs concurrency, draw the SLA line, the intersection is that config's ceiling
5. p99 spike or preemption jump -> roll back, do not ship

Start a server that is easy to load-test (parameters follow official docs; add or drop as needed):

vllm serve NousResearch/Meta-Llama-3-8B-Instruct --dtype auto --api-key token-abc123 --max-num-seqs 32 --gpu-memory-utilization 0.9

During load, check queueing and cache headroom:

curl -s http://localhost:8000/metrics | grep -E "num_requests_waiting|gpu_cache_usage_perc|num_preemptions_total"

num_requests_waiting climbing means concurrency exceeds capacity; gpu_cache_usage_perc near 1 means KV cache is nearly full; num_preemptions_total rising means preempt-and-recompute. Any one of these firing means lower concurrency or enlarge the cache, not push TPS harder.

Three Failure Cases (Built from Typical Production Scenarios)

Case one: max-num-seqs to 256 raised TPS and crashed p99. An online support bot lifted its concurrency cap from 32 to 256. TPS doubled, but users reported waiting seconds. Metrics showed num_requests_waiting and num_preemptions_total both climbing — the real cause was too little memory for 256 sequences of KV cache, so the system kept preempting and recomputing. Rolling back to 48 with enough KV cache headroom produced higher goodput than 256. Lesson: TPS rising together with preemptions is a false win.

Case two: long prompts blocked short ones; chunked prefill fixed it. A document Q&A service took prompts of tens of thousands of tokens, and even "hello" waited seconds. The long prompt's prefill ran to completion before anything behind it. Enabling --enable-chunked-prefill with a max-num-batched-tokens granularity that split a single prefill dropped short-request TTFT from seconds to milliseconds. Lesson: for TTFT spikes, look at prefill queue blocking before adding GPUs.

Case three: gpu-memory-utilization 0.98 caused more OOM. A team tried to squeeze the card and set utilization to 0.98, then OOMed as soon as concurrency rose. The room left for KV cache and overhead was smaller than at 0.9. Returning to 0.9 and adjusting KV cache dtype restored both concurrency and stability. Lesson: memory utilization is not "the higher the better"; it trades off against concurrency.

Quick Reference

Symptom First metric Likely cause Action
High TPS, users report slowness p99 / TTFT Queueing too long Lower max-num-seqs, judge by goodput
TTFT suddenly spikes Queue + prefill length Long prompt blocking Enable chunked prefill, shrink batch budget
OOM as soon as concurrency rises KV cache use Cache pool squeezed Lower gpu-memory-utilization or switch KV dtype to fp8
Preemptions climbing num_preemptions_total Not enough memory for concurrency Lower concurrency or KV cache footprint
Online and offline slow each other Their p99 curves Co-located contention Split into two deployments and route

Originality statement: The parameter semantics, verification flow and cases in this article are the author's own synthesis from the official vLLM documentation and hands-on production tuning. The three cases are built from typical production scenarios, not records of a specific customer site.