Unit 9 of 12 · about 3 hours · measure

Raw timestamps, decode gaps, and memory, utilization and power context

Summaries hide the gaps and stalls that explain tails. Raw records plus resource context are what let you or anyone else re-analyze a run.

You'll be able to

  • Retain raw per-request timestamps and per-token decode gaps instead of summary statistics.
  • Record memory, utilization and power beside every timing run.
  • Normalize energy comparisons per accepted token and state what the meter actually measures.

Covers

Raw request timestamps and decode-gap recordsGPU memory, utilization and power contextEnergy-normalized serving comparisons
1

Read

In this order, only the parts listed

0 of 4 done

  1. Histograms and counters worth keepingvLLM Metrics Design and Production Metrics

    v1 Metrics with the TTFT, inter-token, per-request TPOT, end-to-end, prefill, decode and queue histograms (vllm:time_to_first_token_seconds, vllm:inter_token_latency_seconds, vllm:request_time_per_output_token_seconds, vllm:e2e_request_latency_seconds, vllm:request_prefill_time_seconds, vllm:request_decode_time_seconds, vllm:request_queue_time_seconds); Metrics Publishing - Logging with the 5-second summary; Prefix Cache metrics with hits and queries as counters

  2. Per-request result filesvLLM Benchmark CLI (v0.31.0)

    Custom Dataset example with save-result, save-detailed and result-dir; Results Visualization with the timeline and dataset-statistics plots

  3. Resource context beside every runAI Systems Performance Engineering - Chapter 16, profiling and debugging inference

    Monitoring System Metrics and Counters (pp. 964 to 969): the Prometheus and Grafana stack with SM busy, memory used, copy-engine, link throughput, temperature, power and per-node request metrics

  4. A monitoring bundle you can runAI Systems Performance Engineering companion code - Chapter 16

    monitoring_bundle.py writing the Prometheus scrape, recording-rule, alert and Grafana files; monitoring_config.py for the TTFT, prefill, decode and KV thresholds

    Use the bundle as scaffolding for your own dashboard. Re-measure every bundled threshold on your device instead of adopting it, and check its metric names against v0.31.0 first: vllm:time_per_output_token_seconds and vllm:gpu_cache_usage_perc are now vllm:inter_token_latency_seconds and vllm:kv_cache_usage_perc, and vllm:cudagraph_mode_info does not exist.

2

Focus on

  • Keep arrival, first-token and per-token completion timestamps per request, plus the decode gaps between them. Percentiles are computed from these records, never stored instead of them.
  • Resource context means GPU memory used, utilization, copy-engine activity, power and temperature with timestamps aligned to the requests. A timing without its context is not re-analyzable.
  • Report memory in stated units with the dtype and configuration beside it. Gigabytes and gibibytes differ by about 7 percent, which exceeds many claimed wins.
  • Energy comparisons divide measured joules by accepted tokens under the same quality gate. Name the meter, its sampling interval and whether it covers the host or only the device.
Common mistakes · 3
  • Keeping only mean latency and throughput. Means hide gaps, stalls and tails; the per-token record is the evidence.
  • Quoting memory without units or dtype. A 14 GB weight total at 2 bytes per parameter is decimal gigabytes; mixing in gibibytes silently moves every capacity claim.
  • Comparing energy per token across runs with different output acceptance. Rejected or truncated outputs still cost energy; normalize by accepted tokens.
3

Try it yourself

Closed-book, before checking anything

Closed-book, list the raw fields one request record needs for full re-analysis: arrival, queue, prefill, per-token and completion timestamps with prompt and output lengths, plus the aligned memory, utilization and power samples.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Why keep per-token gaps when you already store TPOT per request?Answer

    TPOT averages one request's decode time. Gaps show where stalls landed, which requests interfered, and what the tail is made of.

  2. 2.A run reports 14 GB model memory. What must accompany that number?Answer

    The unit convention, the parameter count with bytes per parameter, and the configuration. Without them the number cannot be checked.

  3. 3.Two servers report the same tokens per joule. One meter covers the device, the other the whole host. Comparable?Answer

    No. State the meter boundary and sampling interval first; host power includes work the device meter never sees.

  4. 4.Where do prefix-cache hits and queries belong in the raw record?Answer

    As counters beside the requests, so hit rate is computed per interval. Storing only the rate loses the query volume behind it.

You're done when

A stranger can recompute your percentiles, gaps and energy numbers from your stored records plus stated units and meter boundaries.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 8 more in the section
  • AI Systems Performance Engineering - Chapter 16, profiling and debugging inferenceChris Fregly (O'Reilly) · required

    Read the first part of Chapter 16: monitoring system metrics, profiling with Nsight Systems and Nsight Compute, the troubleshooting recipes and debugging correctness. Treat every quoted speedup as a hypothesis for your own hardware.

  • AI Systems Performance Engineering companion code - Chapter 16Chris Fregly · required

    Begin with inference_profiling.py, inference_server_load_test.py, monitoring_bundle.py and runtime scheduler instrumentation. Run only hardware-compatible targets, retain raw artifacts and re-measure all bundled expectations on your own device.

  • vLLM Metrics Design and Production MetricsvLLM Project · required

    Map scheduler and cache events to exported request, queue, TTFT, inter-token and generation metrics. The link is pinned to v0.31.0; check the definitions against the version you install.

  • vLLM Benchmark CLI (v0.31.0)vLLM Project · required

    Use vllm bench latency, vllm bench throughput and vllm bench serve for phase and endpoint baselines. Fix the dataset, lengths, request rate, warmup and sampling, and keep the raw per-request results.

Also in this section

  • Efficiently Scaling Transformer InferenceMLSys · primary

    Read the prefill and decode cost, memory, batching and parallelism sections. Use its models to predict phase bottlenecks before measurement and record which assumptions fail on the selected model, engine and GPU.

  • Hands-On LLM Serving and Optimization - Chapter 5 and the Chapter 4 metrics sectionChi Wang and Peiheng Hu (O'Reilly) · required

    Read Chapter 5 on GPU specifications, model loading and arithmetic intensity in the prefill and decode phases, and "Measuring Performance in LLM Serving" in Chapter 4. Turn each claim into a prediction for one short-prompt and one long-prompt workload.

  • TensorRT-LLM Benchmarking GuideNVIDIA · support

    Use Before Benchmarking and Online Serving Benchmarking as a reproducibility checklist. Borrow environment capture and startup metrics even if TensorRT-LLM is not the selected engine.

  • Time to First Token - Measurement and Load-Testing SessionsPatchy631 · support

    Use only Week 3 and Week 5 as a practical checklist for Prometheus, Grafana and request-rate sweeps. Follow the competency gate rather than its calendar, and replace fixed concurrency goals with your hardware-safe saturation range.

  • LLM Inference Systems Laboratory - InstrumentationRoadmap-Final · support

    Complete Milestone B: correlate request, iteration, KV, scheduler, kernel and resource events, quantify observer overhead, and retain raw arrival and completion records.

  • Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-ServeAgrawal et al. · support

    Read arXiv v3, Chunked-prefills and Stall-free batching for the chunked-prefill vocabulary and the prefill-decode interference argument, and Overhead of chunked-prefills for the cost of splitting. Treat the reported capacity gains as the paper's result on its hardware.

  • py-spy - sampling profiler for PythonBen Frederick · support

    Use py-spy record to take CPU flame graphs of tokenizer and detokenizer work, and py-spy top to watch the hot functions live. Launch the profiled process under py-spy.

  • vLLM SamplingParams API (v0.31.0)vLLM Project · reference

    Look up temperature, seed, max_tokens, ignore_eos, stop and stop_token_ids defaults when you fix the output contract. The link is pinned to v0.31.0; check the fields against the version you install.