- How to select and port-forward to a single model pod.
- How to watch runtime gauges that reveal request lifecycle and KV cache usage.
- How to issue a streaming completion and observe prefill, streaming decode, and scratchpad behavior.
- kubectl configured to the cluster where the model pods run.
- A model pod labeled
llm-d.ai/role=decodeis running in the namespace you choose. - curl and watch installed on your local machine.
- Prepare your shell
Make sure you export the correct
NAMESPACE and that the pod you pick is a decode pod. Choosing the wrong namespace or pod may cause commands to fail or target the wrong service.- Wire a straight line to the pod (port-forward)
- Watch the pod’s runtime gauges
vllm:num_requests_running and vllm:kv_cache_usage_perc.
- Issue a streaming completion to the pod
stream is true. We intentionally give a large max_tokens budget to keep the decode loop running long enough to observe prefill and decode on CPU.
- Short silence after sending the request: this is the prefill phase where the model ingests and processes the full prompt in parallel before emitting tokens.
- After the pause, tokens stream back as SSE-style chunks. While tokens stream, switch to the metrics watch window and observe:
vllm:num_requests_runningrises from 0 to 1.vllm:kv_cache_usage_percincreases as the KV scratchpad fills during decoding.
- When the request completes the metrics return to zero, demonstrating the request lifecycle.
- Prefill: the initial pause while the model ingests the prompt.
- Decode: token-by-token streaming output (SSE chunks).
- Scratchpad: the in-memory KV cache used during decoding; visible via
vllm:kv_cache_usage_perc.
On GPU hardware in production, the same prefill + decode loop executes much faster (hundreds of tokens per second). Running on CPU slows the loop so you can observe each stage; the behavior and guarantees remain the same. The KV cache metric reflects real memory usage — not an abstract concept.
- Reintroduce the router and send the same prompt repeatedly to observe request distribution across the fleet.
- Inspect the router configuration (routing “dials”) to understand how it considers cached state when deciding where to route requests.
- Kubernetes Basics
- kubectl port-forward documentation
- SSE (Server-Sent Events) overview: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events