Unit 9 of 12 · about 4 hours · implement, measure

Per-request logs, metrics and traces, and engine and hardware telemetry

Undashboarded serving is unoperated serving. The metric names, phases and trace joins chosen here become every later diagnosis.

You'll be able to

  • Emit per-request logs, metrics and traces joined by request_id that explain one request's TTFT and every decode gap.
  • Build engine dashboards from queue, phase, token, cache and scheduler metrics with alerts on TTFT, KV pressure and stalls.
  • Contrast vLLM and SGLang phase boundaries so dashboards survive an engine swap.

Covers

Per-request logs, metrics and tracesQueue, phase, token, cache and scheduler telemetryGPU, CPU, memory and network telemetry
1

Read

In this order, only the parts listed

0 of 5 done

  1. vLLM production metricsvLLM Production Metrics

    General Metrics table (vllm:num_requests_waiting, vllm:num_requests_running, vllm:kv_cache_usage_perc, vllm:prefix_cache_hits, vllm:request_success, vllm:time_to_first_token_seconds, vllm:request_queue_time_seconds, vllm:request_prefill_time_seconds, vllm:request_decode_time_seconds, vllm:e2e_request_latency_seconds); MFU counters behind --enable-mfu-metrics; Deprecation Policy

  2. vLLM metrics design and tracingvLLM Online Serving, Architecture and Production Metrics

    Scheduler Stats and Engine Core Events, KV Cache Residency Metrics (vllm:kv_block_lifetime_seconds, vllm:kv_block_idle_before_evict_seconds), and Tracing with --otlp-traces-endpoint plus --collect-detailed-traces

  3. SGLang production metricsSGLang documentation - Production Metrics

    TTFT definition (streaming ends at first output after detokenization, which may hold no printable text; non-streaming ends at first scheduler token); request TPOT as (finished_time - first_token_time) / (completion_tokens - 1) with its four exclusions; the p95 TPOT PromQL example (page read 2026-10-14)

  4. AI Systems ch16 monitoring bundle and load harnessAI Systems Performance Engineering - Production Inference Labs

    monitoring_config.py metric names with alert thresholds (TTFT p90 warn 0.6s, p99 crit 1.5s, KV warn 90% crit 98%, stalled floor 50); vllm_monitoring.py recording rules with VLLMHighTTFTP90 alerts and Grafana panels; inference_server_load_test.py load harness feeding capacity_planner.py

    Re-measure every bundled expectation on your hardware. The B200 numbers in the expectations files are the authors' results, not your targets.

  5. Production observability checklistInference Engineering - Chapter 7, Production

    Section 7.4.3 (printed p. 203): volume, request and response sizes, response codes, latency as TTFT plus tokens per second plus end-to-end on P50/P90/P99, replica count, CPU, host memory, GPU and GPU-memory utilization, queue depth; server plus audit logs

2

Focus on

  • One request, one ID, three signals: the log line carries request_id with queue, prefill, decode and stream timings; the histograms carry the same labels; the trace carries the same ID across frontend, scheduler and runner. Diagnosis starts by joining them.
  • Queue versus execution is a metric pair, not a feeling: vllm:request_queue_time_seconds against vllm:request_prefill_time_seconds plus vllm:request_decode_time_seconds. TTFT alone cannot separate them.
  • Gauges describe state (vllm:num_requests_waiting, vllm:kv_cache_usage_perc); counters describe events (vllm:request_success, token totals). Rate the counters, read the gauges, never the reverse.
  • TTFT, TPOT and ITL are engine-defined. SGLang's streaming TTFT ends at first detokenized output (possibly empty text) while vLLM's measures first-token time; a dashboard that compares them across engines compares different quantities.
Common mistakes · 3
  • Labelling metrics by prompt text or user ID. Cardinality explodes Prometheus; label by model, version and class, and join to raw text only through the request ID in logs.
  • Timing decode with per-token host synchronization. The observer serializes the pipeline it measures; prefer engine histograms and sampled profiler ranges over naive timers.
  • Treating vllm:request_success as a gauge. It is a cumulative counter split by finished_reason (stop, length, abort); alert on its rate, and count aborts as cancellations, not successes.
3

Try it yourself

Closed-book, before checking anything

Under a short local load run, scrape /metrics before and after. Show vllm:num_requests_waiting, vllm:kv_cache_usage_perc and the vllm:time_to_first_token_seconds count moving with load, then pull one request's full timeline from logs by its request_id.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.TTFT spikes but prefill time is flat. Queue or execution problem?Answer

    Queue. Flat prefill with rising TTFT means vllm:request_queue_time_seconds grew while execution held; add replicas or shed instead of tuning kernels.

  2. 2.How do you compute per-request decode tokens per second from SGLang's TPOT histogram?Answer

    Take the reciprocal of the TPOT quantile (p5 TPS equals 1 over p95 TPOT). The reciprocal of mean TPOT is not mean TPS; aggregate rates per request first.

  3. 3.Which requests never appear in SGLang's request-TPOT histogram?Answer

    Requests with fewer than two output tokens, streaming requests finishing in their first output, aborted requests and disaggregated prefill workers.

  4. 4.KV usage sits at 0.97 while TTFT p99 reaches 2s. Which ch16 alerts fire, and what do they mean together?Answer

    The KV warn alert (0.97 is above the 90% warn and below the 98% crit) and the TTFT p99 critical alert (2s against 1.5s). Together they point at memory pressure turning into queueing, not slow compute: shed, evict or add capacity.

5

Practice

  • AI Systems ch16: monitoring bundle under load

    Deploy vllm_monitoring.py with configs/vllm_monitoring.yaml against a local vLLM server, drive inference_server_load_test.py, and satisfy the validation checklist in README.md

    Show one alert (TTFT, KV or stalled) firing with its Grafana panel, and record exporter overhead beside the latency numbers.

You're done when

One request ID yields its full timeline across logs, metrics and traces, and your dashboard separates queue, prefill, decode and KV pressure without ambiguity.

Only when you can do this without notes.

Leads to

Notes

Resources · 5 for this unit, 8 more in the section
  • vLLM Online Serving, Architecture and Production MetricsvLLM Project · primary

    Trace the API server, engine core, scheduler, KV manager and model runner, then map documented metrics to your SLIs. The link is pinned to v0.31.0; add the auth, tenant, quality and rollout controls the engine leaves to you.

  • vLLM Production MetricsvLLM Project · required

    Define every selected queue, cache, phase and request metric, check histogram buckets and measure exporter overhead. Add model version, cancellation, rejection, quality sample and tenant-safe trace fields in the surrounding service.

  • Inference Engineering - Chapter 7, ProductionPhilip Kiely (Baseten Books) · support

    Read Chapter 7 for containers, autoscaling, cold starts, routing and queueing, zero-downtime deployment, cost estimation and client-side streaming. Skip the vendor section at its end.

  • SGLang documentation - Production MetricsSGLang Project · support

    Compare its metric names and phase boundaries with vLLM's, so your dashboards do not depend on one engine's vocabulary.

  • AI Systems Performance Engineering - Production Inference LabsChris Fregly · required

    Use Chapter 16 monitoring, cache health, capacity planning and load-test utilities, then Chapter 17 routing only if distributed. Add process death, overload and bad-version cases that the performance pairs do not cover.

Also in this section