Skip to content

Operator task guide

Why is vLLM slow to return the first token?

When vLLM p99 time to first token (TTFT) rises but inter-token latency stays flat, compare queue and prefill time on the same replica and request cohort. A growing queue points to scheduler wait. Longer prefill with a steady queue points to more or slower prompt processing. If both stay flat while client TTFT rises, compare the direct replica path with the gateway path.

Compare requests with similar prompt lengths and cache state. Longer prompts and fewer prefix cache hits both increase the work before the first token. Aggregate latency alone cannot separate them.

Reviewed . Reference guidance is not a diagnosis of your workload.

Step-by-step method

  1. 1

    Compare the same replica and traffic mix

    Record the vLLM version, model, GPU placement, prompt and output lengths, arrival rate and concurrency. Compare matched time windows and check which metrics your release exposes. Capture client TTFT and server TTFT in parallel so gateway retries, routing and streaming can be checked separately.

    curl -fsS http://127.0.0.1:8000/metrics | grep -E '^vllm:(time_to_first_token_seconds|request_queue_time_seconds|request_prefill_time_seconds|inter_token_latency_seconds|request_prompt_tokens|num_requests_waiting|num_requests_running|prefix_cache_hits|prefix_cache_queries|num_preemptions)'
  2. 2

    Measure queue and prefill separately

    Compare vllm:request_queue_time_seconds and vllm:request_prefill_time_seconds over the same window. Pair the queue histogram with waiting and running request counts. If the queue grows while completed throughput flattens, test the same prompt mix at a lower arrival rate to see whether queue time falls.

  3. 3

    Separate long prompts from prefix cache misses

    Check the prompt token distribution and changes in prefix cache hits relative to queries. That ratio describes cached tokens over a window. To test cache effects, compare same-length prompts that share a reusable prefix with prompts of the same length and a unique prefix, on the same replica. Warm the shared prefix before measuring the warm cohort. Keep output length, arrival rate and server settings fixed.

  4. 4

    Run a fixed-load check on a test replica

    Replace YOUR_SERVED_MODEL with the served model ID and verify the flags with your installed vLLM CLI. Run the same command after one change. To isolate input length, repeat with a longer supported input while holding output length and arrival rate fixed. Random inputs exercise prompt length; use the shared-prefix comparison for cache behavior. Repeat the runs and record TTFT, inter-token latency, completed throughput and errors.

    vllm bench serve --backend vllm --base-url http://127.0.0.1:8000 \
      --model YOUR_SERVED_MODEL --dataset-name random \
      --random-input-len 512 --random-output-len 128 --seed 42 \
      --num-prompts 500 --request-rate 4 --percentile-metrics ttft,itl --metric-percentiles 50,95,99

What changed before the first token?

Signals, meanings and actions for why is vllm slow to return the first token?.
SignalWhat it meansNext action
Queue time and waiting requests rise while prefill stays steadyRequests are spending longer waiting to run.Replay the same prompt mix at a lower arrival rate. If queue time and TTFT recover together, check admission limits and replica capacity.
Prefill time rises on long or uncached prompts while queue time stays steadyPrompt processing is contributing more latency.Compare same-length warm and unique prefixes, then compare short and long prompts at a fixed arrival rate. Check prompt token counts and cache reuse.
TTFT rises after a chunked prefill or token budget changeThe scheduler change may have moved latency between prompt processing and decode.Compare the previous and new settings on a test replica using the same request mix. Measure TTFT, inter-token latency and throughput before adopting the change.
Client TTFT rises while server TTFT, queue and prefill stay steadyThe added delay may be outside the measured engine path.Send the same request directly to one test replica and through the gateway. Compare retry counts and the timing of the first streamed response.

Evidence checklist

  • vLLM version, server flags, model revision and GPU placement
  • Client and server TTFT, queue and prefill histograms, and inter-token latency
  • Prompt and completion token distributions, arrival rate and completed throughput
  • Prefix cache hit and query counters, waiting requests and preemptions when available

Common mistakes

Subtracting p99 values

The p99 queue request can differ from the p99 TTFT request. Compare histograms over matched traffic windows and use per-request timing to attribute an individual delay.

Mixing warm and cold prefixes

A rollout or routing change can alter prefix reuse. Keep the replica, prompt length and cache state consistent when testing a scheduler change.

Frequently asked questions

Why did p99 TTFT rise while decode latency stayed flat?

Check whether requests waited longer to be scheduled or spent longer processing their prompts. Compare the engine queue and prefill metrics for the same traffic mix. Compare client and server TTFT if both are steady.

Do prefix cache hits make every token faster?

Prefix reuse skips work on cached prompt tokens. Compare TTFT for warm and unique prefixes at the same input length, and measure inter-token latency separately.

Live diagnosis, no signup

Upload your GPU log. Find what happened first.

Get the likely cause, supporting evidence, and next safe steps with the same cloud reasoning used by paid plans. A crash the engine recognizes is answered in seconds, then checked by an independent AI review that updates this page when it finishes. A crash it does not recognize waits for the AI's own answer, which can take a few minutes. No account, card, or installation. Logs are masked at Denpex API ingress and are not saved to account history.

Before uploading, review cloud data handling and local options.

training_logs.txt
No log to hand? Try one:

Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.

3 free cloud diagnoses per day

Try Denpex for 30 days. FREE.

No credit card. No automatic subscription. See whether Denpex helps with an incident you already understand.

Start your free 30-day Team evaluation

Up to 50 diagnoses a day for 30 days. Verify your work email to activate an eligible company evaluation, then replay a resolved incident and compare the evidence and next steps with your team's confirmed cause.

Use your company email, for example alex@yourcompany.com.

Who qualifies?

Company email domains activate the free 30-day Team evaluation (up to 50 diagnoses a day) after an email and domain check, whatever mail provider you use. If we cannot verify your domain automatically, support reviews it: write to support@denpex.com. Free local diagnosis in the editor extension needs no account.

Using a personal email (Gmail, Outlook, Naver, QQ) or solo cluster? Create a free $0 account (no work email required) to save 7-day history and unlock AI fallback, or send a cluster crash log for a live walkthrough.

Apply the method to your incident

Use the three free diagnoses to review your error and relevant evidence. Keep reference guidance separate from the cause and recovery status of your own workload.

Diagnose your incident