Skip to content

Operating llm-d: autoscaling, rollouts, observability

45 min read

Prerequisites: Inference math: prefill, decode, KV cache, llm-d 1.0 on GKE: routing, disaggregation, KV management

Chapter 20 built a fleet: a Gateway, an Endpoint Picker (EPP), an InferencePool and vLLM-TorchTPU model servers on TPU slices. Running it is a different job. Traffic doubles at nine in the morning and the pool must grow before users notice; a new vLLM image must replace the old one without failing the requests in flight; a P90 TTFT alert fires and someone has to decide in minutes whether the cause is the router, the engines, the TPUs or the autoscaler. This chapter covers that job for llm-d 1.0 on GKE TPU: what to watch and with which exact metric names, how to turn SLOs into alerts, how the autoscaling control loops work and which one fits which workload, why startup time is part of every scaling decision, and how to roll out, drain and route without dropping requests. The emphasis is on mechanisms and control loops. The step-by-step recipes live in the llm-d guides, which this chapter links. Companion code checks every PromQL query against the metric names the llm-d docs define and reads a benchmark against an SLO.

What this chapter covers

  • The four llm-d metric families (model server, router, TPU exporter, cost) on a GKE TPU deployment, the port and prefix of each, and PromQL for TTFT, TPOT, queue wait and saturation with the exact metric names.
  • Alerts on availability and latency SLOs that stay silent at low traffic and catch a pool whose metrics vanish.
  • The llm-d autoscaling control loop (signal, Prometheus, KEDA, HPA, warmup) and how the in-flight, queue, saturation, token-aware and SLO-aware signals suit different workloads.
  • The replica count the SLO-aware control law asks for, and how stabilization windows, the ready-replica credit and pod warmup shape a scale-up.
  • Flow control, readiness probes, graceful draining and the rollout strategies (rolling, blue-green, LoRA adapter, P/D-safe) that change a fleet without failing requests.
  • Scaling on the wrong signal, cold-start storms and KV-blind scale-down, as they appear in dashboard panels and benchmark results.

What an operator watches

An llm-d fleet emits metrics from four places, each on its own port and with its own prefix. Knowing which is which is most of the battle when a panel is empty.

Diagram read left to right in three columns. Left column, four blocks stacked vertically: a blue block labelled vLLM pods, an amber block labelled EPP, a blue block labelled TPU exporter and a grey block labelled OpenCost. Centre: a single grey block labelled Prometheus. Right column, three blocks stacked vertically: a grey block labelled Grafana, an orange block labelled Alertmanager and a green block labelled KEDA. Four arrows run from the left blocks into Prometheus, labelled :8000/metrics, :9090/metrics, :2112/metrics and :9003/metrics. Three arrows run from Prometheus to the right blocks, labelled dashboards, alert rules and triggers.

Four sources, one store, three readers. When a dashboard, an alert and an autoscaler disagree, they are reading the same Prometheus series through different queries, so compare the queries before you suspect the system.

Plane Where Prefix What it answers
Model servers each vLLM or SGLang pod, port 8000, /metrics vllm:, sglang: How long did the engine take, how full is its queue and KV cache, how often does the prefix cache hit
Router the EPP, port 9090, /metrics llm_d_epp_ What the client saw end to end, which pod each request went to, how many requests are in flight or queued, whether the pool is saturated
TPU hardware the GKE device-plugin exporter, port 2112 none: tensorcore_utilization, memory_bandwidth_utilization, duty_cycle, memory_used, memory_total Whether the TPUs are busy and how much HBM bandwidth and capacity they use
Cost OpenCost, port 9003 llm_ What each model costs per hour and per million tokens

Model server metrics. The vLLM metrics the llm-d reference singles out are the ones chapters 17 to 20 used: vllm:num_requests_running and vllm:num_requests_waiting (the batch and the queue; waiting "Non-zero means pods are saturated"), vllm:kv_cache_usage_perc (above 0.9 "requests may get preempted or rejected"), the histograms vllm:time_to_first_token_seconds and vllm:inter_token_latency_seconds, the prefix-cache counters vllm:prefix_cache_hits_total and vllm:prefix_cache_queries_total, and vllm:prompt_tokens_total and vllm:generation_tokens_total. Add vllm:num_preemptions_total, in the PromQL reference's first tier: a sequence evicted from the KV cache and recomputed is the earliest sign that HBM is running out. SGLang's equivalents carry the sglang: prefix.

Router metrics. The EPP sees every request from arrival to last byte, so client-facing SLOs are measured here. llm_d_epp_request_ttft_seconds, llm_d_epp_request_streaming_tpot_seconds and llm_d_epp_request_duration_seconds are histograms per model, flow and priority; the last carries trace exemplars, so a dot on a latency panel opens that request's trace. llm_d_epp_request_total and llm_d_epp_request_error_total give the error ratio, llm_d_epp_ready_endpoints the pool as the router sees it, and llm_d_epp_inflight_requests and llm_d_epp_inflight_tokens the work dispatched to each endpoint and not yet finished. With flow control on, llm_d_epp_flow_control_queue_size, llm_d_epp_flow_control_request_queue_duration_seconds and llm_d_epp_flow_control_pool_saturation show demand the pool could not absorb. One trap: "llm-d 0.10 / llm-d-router 0.11.0 removed the old EPP metric names", so a dashboard built for an older router draws flat lines.

Engine view and router view differ. The router's TTFT includes any time a request waited in flow control; the engine's starts when the engine receives it. When llm_d_epp_request_ttft_seconds climbs and vllm:time_to_first_token_seconds does not, the time is spent before the engine. When both climb, the engines are the bottleneck. That one comparison sorts most latency incidents into the right half of the system.

TPU metrics, read with care. The llm-d TPU page targets the GKE device-plugin's /metrics: tensorcore_utilization and memory_bandwidth_utilization in percent, and the runtime-dependent duty_cycle, memory_used and memory_total. Its rules matter more than the numbers. The model label is the TPU type, not the served LLM. With the recipe's honorLabels: false, the exporter's own pod and namespace labels become exported_pod and exported_namespace; the scrape target's namespace="kube-system" says nothing about the workload. The _node series must not be added to the workload series, or hardware is counted twice. And an absent series is "No data": "Do not replace them with zero or infer that the device is idle." For a memory-bound decode pool, memory_bandwidth_utilization is the TPU metric worth watching (chapter 17); memory_used / memory_total is capacity. ICI is not in the documented interface.

Cost metrics. The inference cost recipe joins OpenCost allocations with vLLM token counts into llm_total_hourly_cost (cost_basis="allocation" for chargeback, "usage" for efficiency), llm_cost_per_million_tokens (by phase: blended, prompt or generation) and llm_cache_savings_fraction. Check its allocation_method label: compute_time splits prefill and decode by vLLM's timings, multiplier falls back to a fixed 2.5x ratio and is an estimate.

Getting the metrics into Prometheus on GKE. GKE ships Managed Service for Prometheus. Automatic application monitoring (--auto-monitoring-scope=ALL) creates PodMonitoring resources for vLLM and SGLang pods but not for the EPP, so the router chart needs monitoring-gke.values.yaml. On a self-managed Prometheus, the Kustomize monitoring component and monitoring.values.yaml create the PodMonitors and the EPP's ServiceMonitor. Confirm every target is up before you trust a panel, and keep two rules from the PromQL reference: histogram_quantile needs by(le), and error series "only appear after the first error occurs".

Dashboards and traces. llm-d ships twelve Grafana dashboards; start with llm-d-failure-saturation-dashboard, then llm-d-router, llm-d-performance-kv-cache and llm-d-tpu-overview. For one slow request, follow a trace: vLLM exports spans with --otlp-traces-endpoint and --collect-detailed-traces=all, the EPP with the router's tracing.values.yaml (tracing-gke.values.yaml for Cloud Trace). The EPP's spans (filter_endpoints, scoring, pick_endpoints, tokenize) beside the engine's llm_request show which side the time went to. The default sampling ratio is 5%.

The companion file code/ch21_operating/promql.md collects the queries this chapter recommends, Q01 to Q40, each with its source. check_queries.py holds every one of them to the 202 metric names defined in the llm-d operations and autoscaling docs.

SLOs and alerts

Three latencies describe an interactive LLM request, and chapter 17 derived floors for the first two. TTFT is the wait for the first token: queueing plus prefill. TPOT is the time per output token after the first, the decode step time a sequence experiences. ITL, inter-token latency, is the gap between consecutive streamed chunks; vLLM's histogram measures ITL, the EPP measures both TPOT and ITL for streaming requests. A fourth, queue wait, is the part of TTFT spent before dispatch, and it is the one autoscaling exists to remove.

An SLO pairs a percentile with a threshold. The llm-d SLO-aware guide's example is "keep P90 time-to-first-token under 3 s and P90 time-per-output-token under 100 ms". Two choices follow. Measure at the router, because that is what the client sees, and keep the engine histograms for diagnosis. And pick the percentile your users feel: a P90 SLO tolerates a slow tenth, a P99 SLO does not, and the alert, the autoscaler and the benchmark must all use the same one.

# Q01  TTFT P90 at the router
histogram_quantile(0.90, sum by(le) (rate(llm_d_epp_request_ttft_seconds_bucket{namespace="llm-d-baseline"}[1m])))

The selector uses chapter 20's baseline deployment, namespace llm-d-baseline. sum by(le) before histogram_quantile is not optional: drop le and the quantile has no buckets to interpolate.

The default alerts. llm-d ships a PrometheusRule for the EPP with two groups. epp.availability: EPPHighErrorRatio (warning, error ratio above 5% for 10 minutes), EPPCriticalErrorRatio (critical, above 20% for 5 minutes), EPPNoReadyEndpoints (critical, llm_d_epp_ready_endpoints == 0 for 2 minutes) and EPPMetricsAbsent (critical, no EPP metrics at all for 5 minutes). epp.selfhealth: data-layer poll and extract errors, which mean the EPP may be routing on stale endpoint state, and abnormal ext-proc stream terminations (only with the EPP flag --enable-grpc-stream-metrics). The severity labels are the hook for routing: page on critical, post warning to a channel.

Two details in that rule set are worth copying into any alert you write. The error-ratio alerts are 0/0-safe: with no traffic the expression has no value and stays silent, and the page suggests adding a request-rate floor so a single failed request at three in the morning does not page anyone:

# Q08  Error ratio above 5%, silent below 1 request per second
sum(rate(llm_d_epp_request_error_total[5m])) / sum(rate(llm_d_epp_request_total[5m])) > 0.05
  and sum(rate(llm_d_epp_request_total[5m])) > 1

And absent() fires only when no series exist anywhere. In a multi-pool deployment, one pool's EPP can die while the others keep reporting, and its series vanish rather than read zero, so neither EPPNoReadyEndpoints nor EPPMetricsAbsent fires. The page's per-pool alert compares the present with the recent past:

# Q10  A pool whose EPP metrics vanished in the last 15 minutes
llm_d_epp_ready_endpoints offset 15m unless llm_d_epp_ready_endpoints

Latency alerts are yours to write. The bundled rules cover availability; the alerting page points to the PromQL reference for queries "you can promote into alerts (for example latency SLOs and flow-control saturation)". A latency alert is Q01 against the threshold, held long enough to ignore one slow minute (say > 3 for 10 minutes), with the same request-rate floor. With the EPP's predicted-latency producer, llm_d_epp_request_slo_violation_total counts violating requests directly, a numerator for an error budget. Put each latency alert beside its likeliest causes: a TTFT breach with a growing engine queue (Q12) is capacity; with a flat engine queue and a growing flow-control queue (Q06) it is admission; with preemptions (Q11) it is KV memory; with fewer ready endpoints than desired replicas (Q22) it is the autoscaler's actuation, the subject of the next three sections.

The autoscaling control loop

llm-d's autoscaling page gives the reason accelerator utilization fails: "GPU utilization can sit near 100% during active batching whether the server is lightly loaded or saturated." The TPU version is the same: a decode-bound engine streams its weights every step whatever the batch, so a busy TPU says little about how loaded the server is (chapter 17). Utilization is also a lagging indicator; it reflects saturation "after it has already occurred, by which point latency has spiked". llm-d scales instead on what the EPP knows about demand: in-flight requests, queued requests, token backlog, pool saturation, or estimated latency against the SLO.

A closed loop read clockwise. On the left a blue box, Model server pods. An arrow labelled /metrics runs up and right into an amber EPP box at the top, whose second line is step 1, exposes metrics. Along the top: EPP to a grey Prometheus box, step 2 scrape; Prometheus to a grey KEDA box, ScaledObject, step 3 PromQL. Step 4, publish, runs down the right side from KEDA to a grey External Metrics API box. Along the bottom, right to left: External Metrics API to a grey HPA box, step 5 external metric; HPA to a grey Deployment box, step 5 desired replicas. An orange arrow labelled pod startup runs from Deployment up into Model server pods. A legend in the middle: a dark arrow, Takes seconds; an orange arrow, Takes minutes.

The numbers are the five steps listed below. Every dark arrow takes seconds and the orange one, pod startup, takes minutes; each tuning knob in this section keeps the fast arrows from overreacting while the slow one catches up.

The pipeline. The recommended path is KEDA with EPP metrics, and it has no custom controller:

  1. The EPP exposes its metrics, for example llm_d_epp_inflight_requests.
  2. Prometheus scrapes the EPP through the router's ServiceMonitor (on GKE, its PodMonitoring).
  3. KEDA's Prometheus scaler evaluates each trigger, a PromQL query that must return a scalar or a single-element vector; scalingModifiers can combine several triggers into one formula.
  4. KEDA publishes the values through its metrics server to the Kubernetes External Metrics API.
  5. The HPA that KEDA generated computes a desired replica count and reconciles the Deployment.

You create a ScaledObject, never a second HPA: "Multiple HPAs targeting the same Deployment conflict with one another." KEDA owns the generated HPA and handles activation from zero; the HPA scales from one to N, shaped by the behavior block that KEDA copies into it from advanced.horizontalPodAutoscalerConfig. cooldownPeriod governs only scale-down to zero.

Per-replica targets. Most triggers use metricType: AverageValue: the HPA divides the aggregate by the target, so in-flight requests summing to 70 with a target of 16 ask for \(\lceil 70/16 \rceil = 5\) replicas, and with several triggers "Kubernetes uses the largest desired replica count". The queue path pairs the flow-control queue size (target 1, unmet demand) with running requests (target 16, concurrency). None of these values is universal: drive representative load, find where adding a replica stops relieving demand, and put the threshold there, because "a larger model or a smaller GPU saturates at lower concurrency." On TPU, measure on your slice, model and parallelism.

Where the loop goes wrong: time. "Model-server pods take minutes to load a model and become Ready", with two consequences. Overshoot: a loading replica serves nothing, the signal stays high, and the HPA keeps asking for more. Reaction-interval mismatch: the HPA reconciles every 15 s, a replica can take on the order of 240 s (the page's Qwen3-8B example), so most readings during a scale-up describe a pool that has not changed yet. The queue path answers with 300 s stabilization windows: the scale-up window "acts on the most conservative" recommendation, giving a loading replica time to help before another is added; the scale-down window stops a flap when a late replica absorbs the backlog. Size the scale-up window to your measured cold start, and know its cost: windows "delay all scale-up equally, not just startup-driven overshoot."

Flow control decides which trigger moves. Flow control is work-conserving: it queues only once the pool is saturated. Below that point llm_d_epp_flow_control_queue_size stays at zero and the running-request trigger scales; above it, the queue trigger reacts. With flow control off, the queue and saturation series do not exist and those triggers resolve to no data. The default inflight signal sidesteps this: the stock EPP's inflight-load-producer emits llm_d_epp_inflight_requests, which rises directly with concurrency. Reactive backlog signals lag it badly; at a concurrency of 40 with the decode running all 40, vllm:num_requests_waiting and the per-endpoint queue "held 0 and KV utilization barely moved".

Choosing a scaling signal

Five signals share the KEDA pipeline, and one deprecated controller sits beside them.

Signal Scales on Threshold Needs Status
In-flight load llm_d_epp_inflight_requests (Q15) per-replica target, 16 in the guide KEDA, Prometheus default, recommended, nightly-tested
Queue depth llm_d_epp_flow_control_queue_size (Q16) plus llm_d_epp_request_running (Q17) 1 queued, 16 running per replica flow control mature
Pool saturation llm_d_epp_flow_control_pool_saturation (Q18) plus running 0.7, a ratio portable across hardware flow control experimental
Token backlog llm_d_epp_inflight_tokens / \(V_P\) (Q19) and vllm:kv_cache_usage_perc (Q20) seconds of prefill wait; KV occupancy 0.8 one peakPrefillThroughput calibration experimental
Estimated latency P90 TTFT and TPOT against the SLO (Q21) band 0.40 to 0.55 a recording rule, kube-state-metrics SLO-aware path
WVA wva_desired_replicas from its own optimizer cost-aware across variants WVA controller deprecated, final release v0.9.0

A decision tree of five white questions down the left, each ending answer leading right to a blue card. Place one model across hardware variants by cost? Yes leads to WVA, deprecated: no replacement; stay only if you depend on it. No leads down to Per-request latency SLOs, one pool, one SLO pair? Yes leads to Estimated latency against the SLO. No leads down to Do prompt lengths vary widely? Yes leads to Token backlog, experimental. No leads down to Is EPP flow control on? Here No leads right to In-flight load, the default, and Yes leads down to Want a threshold that is portable across hardware? Yes leads right to Pool saturation, experimental. No leads down to Queue depth plus running requests.

All five KEDA signals of the table above are here, and most pools end on the default, in-flight load; note that at the flow-control question it is No that leads to the default. Whatever the signal, add Kueue below the HPAs when several models share a fixed TPU budget (experimental; validate a TPU configuration first), then validate the thresholds under load.

Two steps follow every signal. When several models share a fixed TPU budget, add Kueue below the HPAs for quota floors, borrowing and preemption; it is experimental, so validate a TPU configuration first. Then validate the thresholds under load and size the windows to the measured cold start.

Why tokens. "An 8192-token prompt is 16x the prefill work of a 512-token one, and a request counter rates them the same." The token-aware path measures each phase in its own unit. Prefill is a rate problem: llm_d_epp_inflight_tokens counts uncached prompt tokens dispatched but not yet prefilled, and dividing by the calibrated prefill velocity \(V_P\) (peakPrefillThroughput) turns them into seconds of queue wait. Decode is an occupancy problem: vllm:kv_cache_usage_perc is already a fraction, and 0.8 means "act at 80% full", because past a full cache vLLM "stops admitting requests outright". In the co-located topology the current bottleneck wins:

\[ \text{replicas} = \max\left(\left\lceil \frac{\text{backlog seconds}}{1.5} \right\rceil, \left\lceil \frac{\sum \text{KV usage}}{0.8} \right\rceil\right) \]

The prefill threshold is not measured; it is the share of the TTFT budget you will spend queueing, after the irreducible floor:

\[ \text{threshold} \approx \text{TTFT}_\text{SLO} - \frac{\text{ISL}_\text{uncached}}{V_P} \]

No scaling removes the floor: "adding replicas shortens the line, never the work at the front of it". If the SLO is at or below it, change the hardware or shrink the uncached prompt with prefix caching. Because AverageValue makes the signal a per-replica mean, shave the result to 60 to 70% for a P90 or P99 SLO. calibrate.sh measures \(V_P\) = CHUNK_SIZE / median TTFT on an idle stack, with CHUNK_SIZE equal to --max-num-batched-tokens. The guide's reference figures, 15,928 tokens per second for Qwen3-32B on H100 at TP=2 and 2,696 through a P/D path, differ sixfold, and no TPU figure is published: measure on your slice and serving path. The constant is read twice, by the EPP's prefix-cache-affinity-filter and by the KEDA trigger, and both copies must change together.

The SLO-aware control law. The latency-driven path collapses its triggers into one formula whose output is the desired replica count. A recording rule every 15 s forms the pool's P90 latency against both SLOs, the worse of the two:

\[ s_\text{raw} = \max\left(\frac{\text{P90 TTFT}}{S_\text{ttft}}, \frac{\text{P90 TPOT}}{S_\text{tpot}}\right), \qquad s = \text{avg}_{45\,\text{s}}\big(\min(s_\text{raw}, 2)\big) \]

The clamp at 2 is there because "at the queueing knee, predicted latency can spike to 10-90x SLO in one sample", which would poison the moving average long after the pool recovered. Then, with \(n\) provisioned replicas, \(r\) ready, \(\theta_\text{up} = 0.55\) and \(\theta_\text{dn} = 0.40\):

\[ d = \begin{cases} n + \left\lceil n \left( \dfrac{s\,c}{\theta_\text{up}} - 1 \right) \right\rceil & s > \theta_\text{up} \\[2ex] n - \left\lfloor n \left( 1 - \dfrac{s}{\theta_\text{dn}} \right) \right\rfloor & s < \theta_\text{dn} \\[1ex] n & \text{otherwise} \end{cases} \qquad c = \frac{r}{n} \ \text{when } 0 < r < n, \text{ else } 1 \]

Each asymmetry has a job. The band holds the pool steady instead of flapping around one set-point. The credit \(c\) discounts the ask while pods warm, because the ready pods over-report the load the full pool will carry; without it the loop races to maxReplicas every cycle. Scale-down uses the uncredited signal, so a pool sheds only when measured latency has headroom. And the thresholds sit far below 1 on purpose: healthy load holds \(s\) around 0.2 to 0.45, and it "goes vertical at the queueing knee", so 0.55 fires on the rise rather than after the SLO budget is spent. The HPA then clips \(d\) to the bounds; scale-up adds the larger of 100% or 4 pods per 60 s with a 30 s window, scale-down walks one pod per 120 s with a 180 s window. slo_check.py implements \(d\) as written. On H100 the guide reports 95.8% combined SLO attainment at 5.93 replicas on average, against 8 for a static pool sized for the peak.

An animation in sixteen frames of a model of llm-d's SLO-aware autoscaler, four dashboard panels on a shared time axis from 0 to 1,500 seconds. Top left: requests waiting, vllm:num_requests_waiting, with the offered load written in the corner. Top right: the saturation signal s with a grey hold band from 0.40 to 0.55. Bottom left: desired replicas from the HPA as a dashed line and ready replicas, llm_d_epp_ready_endpoints, as a solid blue line, between bounds of 3 and 8. Bottom right: P90 TTFT, llm_d_epp_request_ttft_seconds, against a dashed 3 second SLO, with breaches shaded orange. Frame 1 at 120 s: healthy, s 0.33, 3 replicas. Frame 2 at 240 s: load steps to 5.5 requests per second, the queue grows and s rises to 0.79. Frames 3 to 5, 270 to 345 s: s reaches the clamp of 2, the HPA asks for 5, then 7, then 8 replicas while only 3 are ready, and TTFT climbs to about 12 s. Frame 6 at 375 s: 7 of 8 ready, the queue drains. Frame 7 at 405 s: TTFT back under the SLO. Frames 8 and 9: steady at 10 requests per second on 8 replicas. Frame 10 at 765 s: load falls and the 180 second window holds capacity. Frames 11 to 15: the pool walks down one replica every 120 seconds to the floor of 3. Frame 16 summarizes: TTFT broke the SLO only at the first crossing, 240 to 390 seconds, while new pods warmed up, peaking at 11.9 seconds.

Watch the gap between the dashed and the solid line in the bottom left: every second of it is a second of orange in the bottom right. The decision took 30 s; the capacity took 100 s more.

The animation runs that law and HPA behaviour with the guide's 100 s pod-ready time and bounds of 3 to 8, over a queueing model of the pool calibrated so that \(s\) settles in the band near 1.45 requests per second per replica, where the guide says its loop settles. It is a model, not a measurement, but it shows what the guide reports: residual violations "cluster at the first capacity crossing, where a load step lands on an under-provisioned pool before the new pods finish warming". The fix is not in the control law. "Pod warmup is roughly half the scale-up transient", and the guide's warmup patch, a torch-compile cache volume and a faster startupProbe, cut its pod-ready time from about 2 minutes 15 seconds to about 100 seconds.

WVA and Kueue. WVA, a global optimizer that placed one model across heterogeneous variants by cost and published wva_desired_replicas, is deprecated at its last release, v0.9.0, and "Cost-aware placement across variants has no current equivalent." Its other job, sharing a limited accelerator budget, moved below the autoscaler to Kueue: each model gets a ClusterQueue with a guaranteed floor in a shared cohort, each replica pod waits at a scheduling gate until quota is free, and idle models lend capacity that preemption reclaims. The HPAs stay untouched; over-budget demand shows as Pending pods. The guide's examples account nvidia.com/gpu; the llm-d docs have no TPU Kueue configuration, so validate one before relying on it.

Startup time is part of the loop

The animation's 100 s is the whole story of reactive autoscaling: decisions are cheap, capacity is late, and every second cut from pod-ready time is a second less of violation at every scale-up. Measure first, as llm-d's startup docs ask: cold starts, warm-cache restarts and scale-outs, with fixed revision, image, hardware and parallelism, recording weight loading, compilation and total time to Ready.

What a TPU pod spends its startup on. Scheduling: a TPU pod needs a node of exactly its machine type (chapter 20); if none is free, it waits Pending for node auto-provisioning, which is part of pod-ready time though no autoscaler metric shows it. Weights: a Hub download unless cached. Compilation: a program per token bucket (chapters 7 and 18), which "takes minutes for a large model" when cold. Then engine start. The remedies follow the costs:

Two columns under the heads Phase and What to do. Left, four grey phase boxes joined by downward arrows, ending in a green card: Scheduling, exact machine type; Weights, Hub download unless cached; Compilation, a program per token bucket; Engine start, server up, probes pass; Ready, joins the pool's endpoints. Right, one card on each phase row. Scheduling: a grey card, Count the Pending wait: auto-provisioning; no autoscaler metric shows it. Weights: an orange card, Cache weights near the node: ReadWriteMany PVC; no download storms. Compilation: an orange card, Persist the compile cache: the three cache roots of chapter 18, kept per node. Engine start: an orange card, Size the startupProbe for the cold case: cover the worst measured cold start. The Ready row has no card.

Pod-ready time is the sum of these four phases, and a scale-up waits for all of them. The phases are drawn the same size because no TPU durations are published: measure yours, then remove the largest term, usually compilation or scheduling.

  • Cache weights near the node. Chapter 20's node-local /var/cache/huggingface reuses downloads on one node "but not across nodes or after node replacement"; a ReadWriteMany PVC (the model-cache component) or an in-cluster MatrixHub registry covers the rest.
  • Persist the compile cache. Compiled artifacts under the three cache roots of chapter 18 (VLLM_XLA_CACHE_PATH, TORCH_TPU_TIER3_COMPILATION_CACHE_ROOT, VLLM_CACHE_ROOT; llm-d's startup page names only the last) serve "later compatible starts", though configuration or code changes can recompile anyway. Chapter 20's manifest persists the TPU cache roots per node; a scale-out onto a fresh node still compiles cold.
  • Size the startupProbe for the cold case. failureThreshold × periodSeconds must cover the worst measured cold start "with a margin"; a probe that gives up early restarts a pod that was about to succeed.
  • Avoid download storms. Concurrent weight downloads during scale-outs "can trigger Hugging Face rate limiting (HTTP 429)", and "longer request timeouts do not remove rate limits." Scaling from 3 to 8 is five concurrent full downloads without caches, none with them.
  • Keep a warm floor. minReplicaCount is "the warm floor". Scale-to-zero works (the EPP's flow-control queue holds requests and KEDA activates on it), but cold start becomes request latency, requests queued at zero are lost if the EPP restarts, and the guide enables it only after one-to-N scaling is validated.

Faster actuation on GPUs. Three llm-d mechanisms cut startup much further, and all three are GPU-specific in the llm-d docs. Fast Model Actuation keeps vLLM instances asleep in a launcher: a hot start moves weights back from CPU memory and "resumes in seconds", a warm start takes "tens of seconds". Pod snapshots restore an initialized single-GPU server with GKE Pod Snapshots and gVisor; TP greater than 1 is not supported. ModelExpress moves weights GPU-to-GPU over NIXL and RDMA, 0.93 s per rank against 30.3 s from warm NFS in its example, yet even with compile-cache reuse pod-ready stays at 156 s, because per-pod graph capture "remains the largest fixed cost". What transfers to TPU is the method: decompose pod-ready time and remove the biggest term, which on TPU today is usually compilation and node scheduling.

Readiness is what the router trusts. A pod joins the pool's endpoints when Ready. llm-d's probe guide recommends /v1/models for the startupProbe and readinessProbe, since it "Returns 503 or connection refused during model loading", and /health for liveness only: "The vLLM /health endpoint only indicates that the server process is running, not that models are loaded". (The vLLM model server page says /health is ready after the model loads, which would make it safe too; the dedicated guide's rule costs nothing.) Chapter 20's manifests follow it; worked problem 4 explains each setting. On decode pods, probe the engine's port 8200, not the sidecar's 8000.

Traffic: flow control and many models

Flow control moves queueing from the engines into the EPP: "Hold requests during peak saturation instead of committing them to a server's local queue where they become stuck." A held request is dispatched later to whichever pod is best then. Each request gets a FlowKey, a fairness ID plus a priority, from the headers x-llm-d-inference-fairness-id and x-llm-d-inference-objective; the objective names an InferenceObjective (chapter 20) whose priority picks a band, in the guide premium at 100, standard at 0, best-effort at -10. The dispatcher serves the highest band first, rotates among tenants by the fairness policy, and orders each flow by the ordering policy. It is work-conserving and never throttles spare capacity. A request is rejected only when its band hits maxRequests, a global maxRequests or maxBytes is breached, or it outlives the queue TTL (60 s in the guide); an EPP shutdown evicts queued requests with a retryable 503. The default policies keep the legacy strict FCFS order; what changes at once is where saturated traffic waits.

Strip tenant headers at the edge

Clients that can set x-llm-d-inference-objective: premium-traffic themselves can promote their own traffic. The flow-control guide's production pattern: the ingress gateway strips every incoming x-llm-d-* header, validates the API key or JWT, and injects the authoritative headers from its claims.

Saturation and the dispatch gate. The EPP ships two saturation detectors, and the llm-d docs disagree on which to run. The KEDA design page calls utilization-detector (closed-loop, on queue depth and KV pressure) the "default, recommended" choice; the flow-control guide says "production deployments should switch to concurrency-detector to avoid telemetry lag risks". The tuning page states the trade-off both agree on: utilization tracks real memory and suits varied context lengths, concurrency reacts instantly to sudden bursts but counts requests, blind to KV pressure and cheap cache hits. Choose by workload. For the concurrency detector, the tuning page's three layers set the limit: the engine's compute limit \(N\) (--max-num-seqs), the EPP's maxConcurrency \(= N + B\) with a small lookahead \(B\) that keeps the batcher fed, and a burst queue (maxRequests of 200 or more). The shipped maxConcurrency fits Qwen3-32B on H100 at TP=2 only; derive yours with the tuning wizard on your slice. Flow-control state is per EPP replica.

Many models. Each model gets its own InferencePool, EPP and Deployment with a distinct matchLabels selector, and one ScaledObject whose triggers isolate that pool; an unpinned query on a shared Prometheus "silently aggregates every EPP on the cluster" and scales on other tenants' traffic. Behind one endpoint, the Inference Payload Processor (IPP) maps the request body's model name to its base model and sets X-Gateway-Base-Model-Name, which HTTPRoutes match to a pool; LoRA adapters ride on their base model's pool.

Batch and async work (the Batch Gateway's /v1/batches API, or the Async Processor reading Pub/Sub or Redis with saturation-gated dispatch) fills slack capacity; a low-priority objective such as the best-effort band keeps it behind interactive traffic.

Draining and readiness under change

Scale-down, rolling updates and node drains terminate pods with requests in flight. The sequence: the pod turns Terminating and leaves the InferencePool's endpoints, so no new work arrives; preStop runs; SIGTERM; SIGKILL after terminationGracePeriodSeconds (default 30 s), counted from the start of preStop. vLLM aborts in-flight requests on SIGTERM unless started with --shutdown-timeout N, which keeps serving them for up to N seconds. The guides' overlays, TPU included, ship a 15 s preStop sleep (requests already routed still land on a running engine), --shutdown-timeout 45 and a 75 s grace period, \(15 + 45 + 15\) for teardown; the grace period must exceed the other two, or SIGKILL cuts the drain. Set the timeout near the p99 duration you want to finish, and exec vllm serve if a shell wraps it, or SIGTERM never reaches vLLM.

Disaggregated pools add a dependency: a prefill pod holds a finished prefill's KV cache until decode pulls it. vLLM cannot yet hold a prefill pod open until its blocks are fetched, so the preStop sleep is the mitigation (chapter 20's P/D manifest uses the rollout guide's longer 20 s sleep, --shutdown-timeout=90 and a 150 s grace period for that reason), and the decode pod's routing proxy runs as a native sidecar (restartPolicy: Always on an initContainer) so it outlives the draining engine.

A timeline drawn to scale, two lanes over one axis from 0 to 150 seconds after the pod turns Terminating. Lane Aggregated: an amber block of 15 s, a blue block of 45 s and a grey block of 15 s, ending at 75 s; a SIGTERM tag marks the boundary at 15 s and a tag reading SIGKILL if still running is right-aligned to the end at 75 s. Lane P/D pods: an amber block of 20 s, a blue block of 90 s and a grey block of 40 s, ending at 150 s; SIGTERM at 20 s and SIGKILL if still running at 150 s. Axis ticks at 0 s, 75 s and 150 s; under them the axis title Seconds after the pod turns Terminating. A legend: amber, preStop sleep; blue, vLLM drains in-flight requests, up to the shutdown timeout; grey, Teardown, headroom.

The grace period starts with the preStop sleep, so it must cover the sleep, the drain and the teardown; if it is shorter, SIGKILL cuts the drain. Disaggregated pools sleep longer so that decode pods can still pull the KV of prefills that just finished.

Rollouts

LLM serving makes ordinary rollouts risky: requests run long and cannot migrate, new pods are slow and cold, and a rollback is another cold start. llm-d documents four strategies.

Strategy Mechanism Blast radius Rollback Cost Mode
Rolling update the Deployment replaces pods gradually in one pool every user, at random slow: new pods in reverse a temporary surge standalone and Gateway
Blue-green a second InferencePool; HTTPRoute backendRefs weights move traffic (1%, 5%, 10%, 50%, 100%) exactly the weight you set instant: set the weight back to 0 two full environments Gateway only
LoRA adapter InferenceModelRewrite maps a stable model name to adapter versions with weights the adapter's users instant: change the weights none standalone and Gateway
P/D-safe DisaggregatedSet revisions with the router's rollout screener per revision, weighted by Ready pods revert the template, or rescale two sets each role's maxSurge, or a canary shape DisaggregatedSet

On TPU, capacity decides. Chapter 20 set its baseline Deployment to strategy: Recreate because TPU node pools are fixed-size and a surge pod has nowhere to run. The operational consequence is stark: Recreate deletes every old pod before creating a new one, so any template change is a full outage for as long as the new pods load and compile. The ways out are a rolling update with maxSurge: 0 and maxUnavailable: 1 (reduced capacity, no outage), spare TPU capacity for a surge, or blue-green onto a second pool on its own nodes (a second fleet for the duration, precise percentages, instant rollback). Blue-green is also the strategy for a new TPU generation or slice shape, a new base model or a new serving framework. Where the gateway supports it for an InferencePool, the Gateway API RequestMirror filter can first copy a percentage of live requests to the new pool, whose responses are discarded; judge it by its own metrics.

LoRA adapters change without touching infrastructure: an InferenceModelRewrite (llm-d.ai/v1alpha2) maps the stable name small-segment-lora to small-segment-lora-v1, then splits 90/10 and 50/50 with v2, then sends everything to v2, while vLLM loads adapters at runtime from a resolver directory.

Disaggregated rollouts have a hazard of their own: a request spans two pods, and if prefill and decode run different versions the KV transfer can fail or, "worse, succeed with a mismatched KV layout and return a 200 with wrong output." The router pairs any prefill pod with any decode pod unless the disaggregatedset-rollout-screener plugin (Alpha; the EPP needs allow-experimental-plugins: true) picks one revision per request, weighted by Ready pods, and hides the others from both profiles. It fails closed with a 503 when no revision is complete in every required role. In the reference run, the EPP without the screener "paired 61% of requests across revisions", all returning 200 because the two versions happened to be KV-compatible and nothing reported it; with it, none of 10,315 pairs crossed. Roll out either automatically, by changing the set's template (each role moves within its maxSurge and maxUnavailable, defaults 0 and 1; it cannot pause), or as a manual canary with one DisaggregatedSet per version, moving traffic by patching replicas (2P+2D against 1P+1D sends about 67% to the old version under max-role). Watch the split in llm_d_epp_disaggregatedset_revision_gating_share (Q38), fail-closed requests in Q39, and the x-llm-d-disagg-revision response header. Pin images by tag or digest: pods on different nightly builds cannot exchange KV.

Running the router itself

The EPP is in every request's path. Active-passive replicas give failover (under a second with priority routing); active-active replicas scale throughput nearly linearly (2.7x at 3 replicas) but do not share memory, so the approximate prefix index partitions and flow-control queues are per replica, and the token-aware signal needs a single replica. Budget 0.5 to 1.0 CPU cores per request per second for large agentic prompts, plus idle scraping cost that grows with the pool (about 7.5 cores at 100 pods). And choose failureMode deliberately (chapter 20).

Failure modes

Symptom Mechanism What to check or change
Latency breaches while the autoscaler holds still, or replicas grow on a quiet pool Scaling on the wrong signal: an HPA on CPU or accelerator utilization, which reads high at any batch size; or reactive backlog signals that stay at zero until a replica is already saturated Scale on EPP demand (in-flight, queue, tokens) or estimated latency; compare the trigger's value with Q12 and Q01 on one panel
Queue and TTFT spike at every scale-up, then recover Startup dominates the transient: weights, cold compilation, node provisioning Measure pod-ready time by phase; cache weights; persist compile caches; keep spare TPU nodes or a warm floor; lower \(\theta_\text{up}\) or the threshold only after warmup is short
Many pods start together and all take far longer than one Cold-start storm: concurrent Hub downloads hit HTTP 429; startupProbe restarts pods mid-compile Node or PVC weight caches, pre-staged files; size failureThreshold × periodSeconds to the worst cold start
Replicas race to maxReplicaCount on every load step, then drain Overshoot: pods still warming serve nothing and the signal stays high Scale-up stabilization near the measured cold start, or the SLO-aware credit \(r/n\)
Desired replicas rise, llm_d_epp_ready_endpoints does not Actuation, not metrics: pods Pending on TPU capacity or Kueue quota, image pull, slow load Pod events and scheduling status; the decision is already made
Preemptions (Q11) and rising TPOT after a scale-down KV-blind scale-down: a request-count signal sheds pods while the survivors' KV caches are nearly full; decode holds each request for its whole generation, so recovery lags by a generation time A KV occupancy trigger (Q20) beside the request trigger; slow scale-down; watch Q11 and Q13 after each step down
Prefix hit rate drops after each scale-down Sessions whose history lived on the removed pod prefill again elsewhere (chapter 20) Accept it, or keep a higher floor for agentic traffic; watch Q24 around scale events
Prefill replicas scale up and never down Stale llm_d_epp_inflight_tokens series from removed pods on EPP images v0.10.0 or earlier Move to an image with the fix, or intersect with a live per-endpoint series as the token-aware guide shows
A load test pins the pool at maxReplicaCount Closed-loop clients: in-flight tokens settle at concurrency × ISL whatever the capacity Drive open-loop load at a fixed rate when validating autoscaling
ScaledObject Ready, HPA shows <unknown> targets The trigger query does not resolve (auth, label, missing metric); KEDA may serve fallback replicas while looking healthy ScalingActive condition ValidMetricFound; run the exact query in Prometheus
Pool scales on someone else's traffic Trigger queries not pinned to a namespace and pool on a shared Prometheus Pin namespace and the pool's labels in every trigger
Requests fail during scale-down or rollouts No drain: vLLM without --shutdown-timeout, a grace period shorter than the drain, or a shell swallowing SIGTERM The drain settings above; exec the server
A pool vanished and nothing paged absent() only fires when every pool is gone Q10

Verifying the result

An operated fleet is trustworthy when four things hold: the stack answers end to end, a benchmark of your workload meets the SLO, the dashboards show the scaling decisions and the SLO moving together, and every query you rely on names a real metric.

  1. Smoke test the endpoint. llm-d's healthcheck.sh checks /health (optional), /v1/models and one completion with its latency, can fail on a latency budget and prints JSON for CI. Run it through the Gateway after every deploy, scale event and rollout step:

    ./healthcheck.sh -e http://${IP} -m Qwen/Qwen3-32B -l 5000 -o json
    
  2. Benchmark the deployed stack. llmdbenchmark deploys a harness pod beside the stack, runs a workload profile with a harness such as inference-perf, and collects results locally; --monitoring adds the engines' /metrics to the report. On GKE in Gateway mode pass --gateway-class gke, and the model name exactly as /v1/models returns it. Start with a sanity_*.yaml profile, then the guide's guide_<name>_<n>.yaml load ladder:

    llmdbenchmark --spec guides/optimized-baseline run \
      --endpoint-url "http://${IP}" --gateway-class gke --model Qwen/Qwen3-32B \
      --namespace llm-d-baseline --harness inference-perf --workload sanity_random.yaml --monitoring
    

    Every harness except lm-eval records TTFT, ITL, TPOT, end-to-end latency and throughput and writes harness-agnostic benchmark_report,_stage_*.yaml files (with inference-perf, also per_request_lifecycle_metrics.json). Read the report per stage: the stage where P90 TTFT crosses your SLO is the pool's capacity at that replica count.

  3. Check the result against the SLO. slo_check.py computes nearest-rank p50, p90 and p99 of TTFT and TPOT from per-request records, the verdict at your SLO's percentile, the \(s_\text{raw}\) the SLO-aware autoscaler would see and the replicas its law would ask for. It reads this book's client records (chapter 19's agentic_client.py run --json, or ttft_s and tpot_s fields); the llm-d docs do not document llmdbenchmark's per-request schema, so map its fields yourself. On the synthetic fixtures:

    $ python code/ch21_operating/slo_check.py --cpu-smoke
    == bench_healthy.json (synthetic)
    TTFT ms      939.2     1710.1     2320.3      3000.0  ok
    TPOT ms       44.4       61.6       94.1       100.0  ok
    saturation s_raw = max(1710/3000, 61.6/100) = 0.62  ->  within SLO
    SLO-aware control law at n = 4 ready replicas: asks for 5
    == bench_breach.json (synthetic)
    TTFT ms      993.2     5362.8     8527.1      3000.0  BREACH
    saturation s_raw = max(5363/3000, 61.4/100) = 1.79  ->  SLO breached
    

    The first result is the control law's design in one line: the pool meets its SLO at \(s = 0.62\), yet the autoscaler asks for a fifth replica because \(0.62 > \theta_\text{up}\) puts the pool on the rise toward the knee. The script exits 1 on a breach, so CI can gate a rollout on it.

  4. See the loop close on the dashboard. During a load step, put the scaling signal (Q15, Q19 or Q21), desired replicas beside llm_d_epp_ready_endpoints (Q22), the engine queue (Q12) and router P90 TTFT (Q01) on one time axis, as in the animation. The autoscaling guide's test: "a demand signal rises, the autoscaler raises a replica target, new replicas become ready, and the demand signal comes back down." If the target rises and ready endpoints lag, the break is actuation; if capacity lands and TTFT does not recover, "you scaled on the wrong signal". Confirm the KEDA side too: ScaledObject Ready, HPA ScalingActive with ValidMetricFound, and numbers rather than <unknown> in the HPA's targets.

  5. Prove every query names a real metric.

    $ python code/ch21_operating/check_queries.py --cpu-smoke
    40 queries in promql.md, 202 metric names in the allowlist
    Q01  OK   TTFT P90 at the router
    ...
    broken queries, each must be rejected:
      aggregation with two arguments: rejected
      metric the docs do not define: rejected
      quantile that drops le: rejected
      unbalanced parentheses: rejected
      Grafana variable: rejected
    cpu-smoke: OK
    

    The two-argument case is an easy slip in an SLO-aware query: max(ttft_ratio, tpot_ratio) reads like a function call, but max is an aggregation operator and Prometheus rejects it (Q21 joins the ratios with or). The undefined-metric case uses a plausible name, llm_d_epp_kv_cache_events_dropped_total, that the router metric reference does not define. Against the live stack, --prometheus http://localhost:9090 runs every query and reports series counts; "no data" means a missing target, a gate that is off or a counter that has not fired, never zero.

Worked problems

Problem 1. Chapter 20's baseline pool runs 3 replicas with the KEDA in-flight trigger (Q15, AverageValue 16, bounds 1 to 8, 300 s stabilization windows). sum(llm_d_epp_inflight_requests{...}) steps from 40 to 110 and stays there. How many replicas does the HPA compute, and roughly when do the new replicas serve if pods take 240 s to become ready?

Answer

\(\lceil 110 / 16 \rceil = 7\), within the bound. But the scale-up window acts on the most conservative recommendation in the last 300 s, and pre-step readings ask for \(\lceil 40/16 \rceil = 3\), so the HPA holds 3 until the window contains only post-step readings, about 300 s. The new pods then take 240 s: capacity arrives about 540 s after the load. That is the cost the KEDA page names, windows "delay all scale-up equally". Shorten the cold start, size the window to it, or use the SLO-aware path, whose 30 s window and \(r/n\) credit handle overshoot instead.

Problem 2. You calibrate \(V_P\) on your TPU serving path at 12,000 tokens per second (hypothetical: measure yours). Uncached prompts are about 6,144 tokens and the SLO is P90 TTFT under 4 s. Choose the token-aware prefill threshold, and compute the replicas the prefill trigger asks for when llm_d_epp_inflight_tokens sums to 90,000.

Answer

Floor \(6{,}144 / 12{,}000 = 0.51\) s, so \(4 - 0.51 \approx 3.5\) s of queue budget per replica. The SLO is a P90 and the signal a per-replica mean, so shave to 60 to 70%: take 2.2 s. The backlog is \(90{,}000 / 12{,}000 = 7.5\) s, and the trigger asks for \(\lceil 7.5 / 2.2 \rceil = 4\) replicas. The same 12,000 goes into the prefix-cache-affinity-filter. An SLO of 0.5 s, below the floor, could not be met by any threshold.

Problem 3. An SLO-aware pool has \(n = 4\) ready replicas and smoothed \(s = 0.8\). What does the control law ask for? Fifteen seconds later 6 replicas are provisioned, 4 ready, and \(s = 0.9\). What now, and why not the cap? Check with slo_check.desired_replicas.

Answer

\(4 + \lceil 4 (0.8/0.55 - 1) \rceil = 4 + \lceil 1.82 \rceil = 6\). Then \(c = 4/6\), \(s\,c = 0.6\): \(6 + \lceil 6 (0.6/0.55 - 1) \rceil = 6 + 1 = 7\). Without the credit, \(6 + \lceil 6 (0.9/0.55 - 1) \rceil = 10\), capped at 8. The 0.9 is measured on 4 ready pods carrying load the 2 warming pods will soon share, so the credit asks only for the deficit beyond them. desired_replicas(0.8, 4, 4) returns 6 and desired_replicas(0.9, 6, 4) returns 7.

Problem 4. Chapter 20's baseline-v6e/modelserver.yaml is shown below in outline. Derive its probe and drain settings from first principles, as you would for a new model server: traffic must arrive only after the model is loaded, and in-flight requests must survive a scale-down. Requests run up to about 40 s at p99.

Answer

spec:
  terminationGracePeriodSeconds: 75      # > preStop 15 + shutdown 45, plus teardown
  containers:
  - name: modelserver
    args:
    - serve
    - Qwen/Qwen3-32B
    # ... the existing flags ...
    - --shutdown-timeout=45              # finish in-flight requests on SIGTERM
    lifecycle:
      preStop:
        exec:
          command: ["/bin/sleep", "15"]  # requests already routed reach a running engine
    startupProbe:
      httpGet: {path: /v1/models, port: 8000}
      periodSeconds: 30
      failureThreshold: 120              # covers download and cold compile
    readinessProbe:
      httpGet: {path: /v1/models, port: 8000}
      periodSeconds: 5
      failureThreshold: 3
    livenessProbe:
      httpGet: {path: /health, port: 8000}
      periodSeconds: 10
      failureThreshold: 3
These are the llm-d guides' drain values and probe split, and what chapter 20's manifest ships (a /health readiness probe would pass before the model loads, and without the drain settings a scale-down aborts requests in flight). Keep the startup budget at least your measured worst cold start on the slice. The container runs vllm directly, not through a shell, so SIGTERM reaches it.

Problem 5. Ten minutes after a traffic increase: HPA desired replicas 8 since minute 2; llm_d_epp_ready_endpoints 4 throughout; vllm:num_requests_waiting rising on every pod; P90 TTFT 9 s; the ScaledObject Ready and ScalingActive reporting ValidMetricFound. Where is the loop broken, and what next?

Answer

Signal, query, KEDA and HPA all worked: the target reached 8 in two minutes and the metric resolves. The break is the last arrow, actuation; as the KEDA guide puts it, "the scaler has already made its decision". Inspect pod events and scheduling. On GKE TPU, in rough order: pods Pending for lack of a node of the right machine type (fixed-size pool, auto-provisioning still running, or no capacity), Kueue holding pods at its gate, startup still running (downloads, possibly rate-limited, or cold compilation), or a startupProbe restarting pods mid-compile. Changing thresholds would not help; capacity, caches or a higher warm floor would.

Problem 6. A coding agent's prompts range from 300 to 40,000 tokens with heavy prefix reuse. The pool scales on in-flight requests with a target of 16. At equal request rates, one hour has P90 TTFT at 0.8 s, the next at 7 s, with 3 replicas both times. Explain, and choose a signal.

Answer

A request count rates a 40,000-token prompt like a 300-token one. In the second hour the mix shifted toward long uncached prompts, so the same in-flight count carried far more prefill work, stayed under 16 per replica, and the prefill queues grew unseen. The token-aware signal counts uncached prompt tokens, so prefix hits lower it correctly, and dividing by a calibrated \(V_P\) gives seconds of prefill wait to compare with the TTFT budget, while KV occupancy covers long decodes. It is experimental and needs one calibration on the TPU path and a single EPP replica. With one pool and one SLO pair, the SLO-aware path, which scales on latency whatever causes it, is the alternative.

Quick questions

  1. Name the port and metric prefix of each of the four telemetry planes.
  2. Why can tensorcore_utilization or duty_cycle not drive an LLM autoscaler, and what does llm-d scale on instead?
  3. Router P90 TTFT rises, engine P90 TTFT does not. Where is the time going?
  4. What keeps the bundled error-ratio alert quiet at low traffic, and which query catches one pool's EPP disappearing?
  5. List the five steps of the KEDA plus EPP pipeline. Which object do you create, and which must you never add beside it?
  6. Why does the in-flight signal react before vllm:num_requests_waiting?
  7. What does \(V_P\) convert, where is it used twice, and why must it be measured on your serving path?
  8. What are the three asymmetries of the SLO-aware control law, and what does each prevent?
  9. What makes up pod-ready time for a vLLM-TorchTPU pod on GKE, and which llm-d startup accelerators have no TPU configuration in the llm-d docs?
  10. What do preStop, --shutdown-timeout and terminationGracePeriodSeconds each contribute to a drain, and how must they relate?
  11. Why does strategy: Recreate on fixed-size TPU pools make every template change an outage, and what are the alternatives?
  12. What does the rollout screener prevent in a P/D rollout, and why can the failure be silent?

Key takeaways

  • Four planes feed Prometheus: engines on 8000 (vllm:), the EPP on 9090 (llm_d_epp_), the GKE TPU exporter on 2112 (tensorcore_utilization, memory_bandwidth_utilization and runtime-dependent series), OpenCost on 9003 (llm_). Measure SLOs at the router, diagnose at the engine, and treat an absent series as a question, not a zero.
  • The bundled alerts cover availability and stay silent without traffic; add latency SLO alerts from the router histograms with a request-rate floor, and catch a vanished pool with offset ... unless.
  • llm-d scales on demand, not utilization: KEDA reads EPP metrics through Prometheus and owns one HPA per Deployment. In-flight requests are the default, queue depth needs flow control, token backlog fits mixed prompt sizes after a \(V_P\) calibration, and the SLO-aware law scales on latency over SLO with a 0.40 to 0.55 band and an \(r/n\) credit. WVA is deprecated; Kueue shares a fixed accelerator budget below the HPAs.
  • Startup is part of the loop: pod warmup is about half of every scale-up transient and the reason violations cluster at capacity crossings. On TPU the levers are persistent compile caches, cached weights, a sized startupProbe and spare node capacity; FMA, pod snapshots and ModelExpress are GPU-only in the llm-d docs.
  • Flow control holds saturated traffic in the EPP and dispatches by band and fairness; strip x-llm-d-* headers at the edge. The llm-d docs disagree on the saturation detector, so choose by burstiness and context variance.
  • Drain with a preStop sleep, --shutdown-timeout and a longer grace period, and probe readiness on /v1/models. Use blue-green for risky changes and new hardware, InferenceModelRewrite for adapters and the rollout screener for P/D, where a cross-version pair can return a wrong 200. On fixed-size TPU pools, plan rollout capacity first.
  • Trust the fleet when the smoke test passes after every change, a staged benchmark meets the SLO at its percentile, signal, desired and ready replicas and TTFT line up during a load step, and every query passes check_queries.py.

References