# Inference Metrics 12 metrics to track by default: Measure **end-to-end** **latency** broken down into **queueing**, **prefill** (queue+prefill = TTFT) and **decode** (~ TPOT), as well as **inter-token latency** (ITL) with instrumentation on my inference server. Examine **total token throughput**, **GPU compute and memory bandwidths**, **KV-cache utilization**, and **preemptions.** Finally, track **input and output token sequence length** distributions. With those core metrics, you can identify around 10 major classes of inference performance issues. While sequence length distributions help distinguish changes in workload characteristics from actual performance degradation. |Issue|Diagnostic metric combination| |---|---| |Prefill compute saturation|↑ TTFT, ↑ compute utilization| |Decode compute saturation|↑ TPOT, ↑ compute utilization| |Decode bandwidth saturation|↑ TPOT, ↑ DRAM activity| |Prefill interference|ITL spikes correlated with prefill activity| |KV cache exhaustion|↑ KV utilization, ↑ preemptions| |Excessive batching|↑ running requests, ↑ TPOT| |Insufficient batching|↓ GPU utilization, ↓ throughput, waiting requests| |Serving capacity exhaustion|↑ queue time, saturated GPU resources| |Scheduler bottleneck|↑ queue time, ↓ GPU utilization| |Communication or execution overhead|↑ TPOT, ↓ compute and DRAM activity| This gives you a strong first-level diagnostic framework. What remains difficult to diagnose? - Inter-GPU communication bottlenecks. - Inefficient GPU kernels. - CPU and tokenization bottlenecks. - Ineffective prefix caching or draft token acceptance rates during speculative decoding. ## Infrastructure setup A sensible way of setting up your infrastructure to track those metrics is by applying the Helm chart for the Nvidia GPU operator to your Kubernetes cluster: - Install the monitoring stack using the kube-prometheus-stack Helm chart. This provides Prometheus, Grafana and Alertmanager. - Install the NVIDIA GPU Operator using NVIDIA’s Helm chart. It automatically deploys the required GPU components, including DCGM Exporter, on GPU nodes. - Deploy the inference engine, requesting GPUs through the Kubernetes resource nvidia.com/gpu. - Configure ServiceMonitors so Prometheus discovers and scrapes both DCGM Exporter and the inference engine’s metrics endpoints. - Configure Grafana dashboards that correlate GPU and inference performance metrics. - Configure Alertmanager for latency SLO violations, preemptions and resource saturation. ### Important configuration details - Explicitly configure DCGM Exporter to collect profiling metrics DCGM_FI_PROF_DRAM_ACTIVE, DCGM_FI_PROF_SM_ACTIVE and DCGM_FI_PROF_PIPE_TENSOR_ACTIVE. - Ensure Prometheus discovers ServiceMonitors across the relevant namespaces. - If your GPU nodes already have NVIDIA drivers installed, configure the GPU Operator not to reinstall them. Standard GPU utilization (DCGM_FI_DEV_GPU_UTIL) tells you whether the GPU is busy, but not what resource is limiting performance. |Profiling metric|What it measures| |---|---| |DRAM_ACTIVE|Fraction of time GPU memory is actively transferring data.| |SM_ACTIVE|Fraction of time streaming multiprocessors are active.| |PIPE_TENSOR_ACTIVE|Fraction of time tensor cores are active.| |DEV_GPU_UTIL|GPU utilization| |PROF_DRAM_ACTIVE|Memory bandwidth activity| |DEV_FB_USED|GPU memory used| |DEV_FB_FREE|GPU memory free| These help distinguish: - Memory-bound inference: high DRAM activity, relatively low tensor core activity. - Compute-bound inference: high tensor core activity. - Execution bottlenecks: low activity across all three despite pending requests. Note: high DRAM activity does not necessarily mean maximum memory bandwidth is being achieved. ### Instrument the inference server vLLM already exposes the following metrics through its /metrics endpoint. |Metric|Prometheus metric (prefix vllm:)| |---|---| |End-to-end latency|e2e_request_latency_seconds| |Queueing time|request_queue_time_seconds| |Prefill time|request_prefill_time_seconds| |Decode time|request_decode_time_seconds| |TTFT|time_to_first_token_seconds| |TPOT|request_time_per_output_token_seconds| |ITL|inter_token_latency_seconds| |Input token throughput|prompt_tokens_total| |Output token throughput|generation_tokens_total| |KV cache utilization|kv_cache_usage_perc| |Preemptions|num_preemptions_total| |Input sequence lengths|request_prompt_tokens| |Output sequence lengths|request_generation_tokens| |Running requests|num_requests_running| |Waiting requests|num_requests_waiting| ### Configure Prometheus Install kube-prometheus-stack via Helm and configure two ServiceMonitors: |Target|Endpoint|Scrape interval| |---|---|---| |vLLM instances|:8000/metrics|5 seconds| |DCGM Exporter|:9400/metrics|5 seconds| Ensure that: - Prometheus discovers ServiceMonitors across both namespaces. - DCGM’s sampling interval is aligned with the scrape interval. - GPU and inference metrics can be correlated using Kubernetes pod, namespace and node labels. - Every inference replica is scraped individually. ### Configure the Grafana dashboard Organize the dashboard into seven rows: ``` 1 · Request latency breakdown Queue, Prefill, Decode time 2 · Token latency TTFT / TPOT, ITL 3 · Throughput Input tokens/s, Output tokens/s 4 · GPU utilization SM / tensor activity, DRAM activity 5 · Memory and cache KV cache utilization, Preemptions/s 6 · Scheduling Running requests, Waiting requests 7 · Workload characteristics Input, Output length distribution ``` Rather than building everything from scratch, start with: - [Official vLLM Grafana dashboards](https://github.com/vllm-project/vllm/tree/main/examples/observability/dashboards/grafana?utm_source=chatgpt.com)⁠ - [NVIDIA DCGM Exporter Grafana dashboard](https://grafana.com/grafana/dashboards/12239-nvidia-dcgm-exporter-dashboard/?utm_source=chatgpt.com)⁠ Combine and extend these to produce the unified diagnostic dashboard described above. The entire infrastructure can be managed declaratively through Helm and GitOps. Official documentation: [GPU Operator installation](https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html?utm_source=chatgpt.com)⁠ · [Prometheus integration](https://docs.nvidia.com/datacenter/cloud-native/gpu-telemetry/latest/kube-prometheus.html?utm_source=chatgpt.com)⁠.