Inference-Aware Load Balancing for LLMs (part 12): day 2, failures, drains and rollouts, measured

What happens to streamed LLM answers when a model replica is deleted, the endpoint picker restarts or the model rolls: a preStop drain and grace period configured on camera, picker failure modes, cold replicas, and what to pin.
Hand-drawn: 1-2 streams cut when a replica is deleted without a drain, 0 cut with a 30 s preStop and 90 s grace period

On this page

Four clients streaming answers from two model replicas, nonstop; ten seconds in, one replica is deleted, the way a node drain or a rollout would. Without a drain: 1, 2 and 2 streams cut in three runs, and the answer rate fell by up to half for 30 s. With a 30 s preStop sleep and a 90 s grace period: 0, 0 and 0 cut, and no dip at all. Then the endpoint picker deleted under load, a rolling restart of the model, and the versions to pin. This is part 12 of Inference-Aware Load Balancing for LLMs, configured on camera. It goes with a video on the LevelUP I.T. YouTube channel.

Answers completed while the pod was going
Answers completed while the pod was going

Day 2: pods go away

Every replica is deleted many times: a node drained for patching, a rollout, the autoscaler from part 9 scaling in, an eviction. For a web app a deleted pod costs milliseconds of requests. For an LLM a request is a stream, seconds to minutes long, and a cut stream is a half-written answer the client cannot resume. On a graceful delete Kubernetes marks the pod Terminating and removes it from the Service's ready endpoints, runs the preStop hook, sends SIGTERM, and sends SIGKILL when the grace period ends. Those steps run at the same time as the gateway and the endpoint picker learning that the pod is going. The question is which happens first.

The tool

steady.py, added to the client pod: W workers each stream a request of exactly 48 tokens, wait 0.25 s and stream the next; every 5 s one line counts answers completed whole (ok), streams that started 200 and ended before the last token (cut), requests that failed before any answer (error) and requests started. Delete something while it runs and read the line where it happened. Lines are counted by when a request ended.

What the generated Deployment carries

gen.py writes every model Deployment with three day-2 settings:

14:  strategy: {type: RollingUpdate, rollingUpdate: {maxSurge: 0, maxUnavailable: 1}}
24:      terminationGracePeriodSeconds: 90
29:        args: ["LiquidAI/LFM2.5-1.2B-Instruct", "--revision", "b9d816ab510f9a28dca37cb182e9da8b0226e13c", ...
36:        readinessProbe: {httpGet: {path: /health, port: 8000}, periodSeconds: 5}
37:        lifecycle: {preStop: {sleep: {seconds: 30}}}

strategy {"maxSurge":0,"maxUnavailable":1}
grace 90
preStop {"preStop":{"sleep":{"seconds":30}}}
  • preStop sleep 30 s: the container keeps serving for 30 s after the delete, before any signal. The sleep action is run by the kubelet, so the image needs no shell.
  • terminationGracePeriodSeconds 90: 30 s of preStop, then up to 60 s for vLLM after SIGTERM.
  • maxSurge 0, maxUnavailable 1: the default (25%) never finishes here. A replica fills its node, so the surge pod never schedules, and 25% of 2 unavailable rounds down to 0: the rollout waits forever, and did while this lab was being built.

This post is for paying subscribers only

Subscribe to LevelUp I.T. newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox. It's free!
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!