Cut llm-d pod startup on TPU¶
Use this guide when new TPU model-server pods take minutes to become Ready, so scale-ups, rollouts and restarts arrive late. A TPU pod's startup is scheduling (a node of exactly its machine type), weight download, XLA compilation of every shape bucket and engine start. Measure it, then remove the largest term. Chapter 21 explains why pod-ready time dominates every autoscaling transient.
Pod-ready time is the sum of these four phases, drawn at equal widths because their sizes depend on the model and the cache state: measure them (step 1) and remove the largest. On TPU the levers are steps 2 to 6; a warm floor and the startup probe act on the whole start, and faster actuation is GPU only.
Prerequisites¶
- A deployed llm-d path on TPU (Optimized baseline).
- For the PVC cache: a
ReadWriteManystorage class. - Keep compiled programs across restarts for the vLLM-TorchTPU cache roots in detail.
Steps¶
1. Measure startup by phase¶
Compare cold starts, warm-cache restarts and scale-outs with the model revision, image, slice and parallelism fixed. Record weight loading, compilation and total time to all target pods Ready, noting the cache state.
kubectl get pods -n ${NAMESPACE} -w
kubectl logs -n ${NAMESPACE} <pod> -f
Check: you have three numbers (cold, warm restart, scale-out onto a fresh node) and know which phase dominates each.
2. Cache weights near the node¶
The TPU overlays already mount a node-local cache, hostPath /var/cache/huggingface (the gke-model-cache-hostpath component): one download per node, kept across pod restarts, but not across nodes or after node replacement. Size the boot disk for it (at least 200 GB for Qwen3-32B, 1 TB for Qwen3.5-397B-A17B-FP8, 1.5 TB per host for GLM-5.2). To share downloads across nodes, add the model-cache component, which puts HF_HOME=/model-cache on an RWX PVC:
kubectl -n "${NAMESPACE}" apply \
-f guides/recipes/modelserver/components/model-cache/model-cache-pvc.yaml
# add the model-cache component to your overlay's kustomization.yaml, then:
kubectl kustomize "${MODEL_SERVER_OVERLAY}"
Pin --revision to a commit SHA in vllm serve. For public models, mark the HF_TOKEN Secret reference optional: true.
Check: the rendered modelserver container has HF_HOME=/model-cache and a /model-cache mount backed by model-pvc, with no duplicates; a second pod on another node logs no download.
3. Persist the compile cache¶
Point the compile caches at persistent, writable storage so later compatible starts reuse compiled programs. The companion manifest code/ch20_llm_d/manifests/baseline-v6e/modelserver.yaml sets the three vLLM-TorchTPU cache roots on a node-local hostPath (any writable path works):
env:
- name: VLLM_XLA_CACHE_PATH
value: /mnt/cache/xla
- name: TORCH_TPU_TIER3_COMPILATION_CACHE_ROOT
value: /mnt/cache/torch_tpu
- name: VLLM_CACHE_ROOT
value: /mnt/cache/vllm
volumeMounts:
- name: compile-cache
mountPath: /mnt/cache
volumes:
- name: compile-cache
hostPath:
path: /var/cache/vllm-torchtpu-compile
type: DirectoryOrCreate
The first start still compiles. Configuration or code changes can recompile anyway, and a node-local cache helps only on that node: a scale-out onto a fresh node compiles cold.
Check: a pod restarted on the same node reaches Ready markedly faster than the cold start of step 1.
4. Size the startup probe for the cold case¶
If pods restart during startup, check events and logs to confirm the startupProbe (not a crash) is the cause, then make failureThreshold x periodSeconds cover the worst measured cold start with a margin. Keep the probe handler (/v1/models); see Rollouts, step 1.
Check: kubectl get events -n ${NAMESPACE} --field-selector involvedObject.name=<pod> shows no startup-probe kills on a cold start.
5. Avoid download storms¶
Concurrent downloads during a scale-out or rollout can hit Hugging Face rate limiting (HTTP 429); longer timeouts do not remove rate limits. Use the caches above or pre-stage files. For timeouts, set HF_HUB_DOWNLOAD_TIMEOUT and HF_HUB_ETAG_TIMEOUT (seconds) in modelserver.env; for hf-xet failures, try HF_HUB_DISABLE_XET=1 only while diagnosing.
Check: a scale-out of several replicas logs no HTTP 429.
6. Keep a warm floor¶
minReplicaCount on the autoscaler is the warm floor (Autoscaling). Scale to zero turns cold start into request latency; enable it only after one-to-N scaling is validated.
Check: at the floor, a load step is absorbed while new pods warm.
7. Know what is GPU only¶
The faster actuation mechanisms are GPU specific in llm-d 1.0: ModelExpress peer-to-peer weight transfer (GPU-to-GPU NIXL/RDMA), pod snapshots (single-GPU vLLM and SGLang on GKE) and Fast Model Actuation sleep/wake, with or without KEDA scale from zero. On TPU the levers are steps 2 to 6.
Check: not applicable on TPU.
Troubleshooting¶
| Symptom | Cause | Fix |
|---|---|---|
Pod Pending for minutes before startup |
No free node of the machine type; auto-provisioning | Part of startup: spare capacity or a warm floor |
| Pod evicted mid-download, node recycled | Boot disk below the checkpoint plus eviction threshold | Larger boot disk |
| Restarts while compiling | startupProbe budget shorter than a cold compile |
Step 4 |
| Every restart compiles from scratch | Compile cache not persisted, or config changed | Step 3; keep flags fixed |
| Many pods start slowly together | HTTP 429 from the Hub | Caches or pre-staged files |
Read-only file system while caching |
Preloaded checkpoint mount is read-only | A separate writable download cache |
| Insufficient cache space | Download landed on the wrong mount, or the volume is too small | Check the mount; room for the checkpoint plus temporary files |
References¶
- llm-d: Load and Cache Model Weights
- llm-d: Troubleshoot Model Startup
- llm-d: Reuse Warm Model Servers (FMA)
- llm-d: Scale from Zero with FMA and KEDA
- llm-d: Restore from Pod Snapshots
- llm-d: Transfer Weights Peer-to-Peer (ModelExpress)
- llm-d: Google Cloud TPU
- Companion code: code/ch20_llm_d/
- Chapter 21: Operating llm-d: autoscaling, rollouts, observability
