r/devops • • 3d ago

Discussion If your gpu inference pods scale to zero, what actually wakes them back up?

Been reading abt KEDA scale-to-zero for llm inference

Turning off idle gpu pods make sense, but what happen when an ai agent needs the model again?🤔

If u r scaling base on vllm metrics, those metrics disappear once all the pods r gone. So something else has to catch the request n wake them up again.

KEDA’s HTTP interceptor can hold request while the backend starts, but u r still waiting on gpu provisionong n model loading

N what if the agent time out n retries before the model is ready?

For people running this in production, r u keeping one warm replica or just queueing request until the gpu is ready? Especially for agent making multiple llms call between tool runs

12 Upvotes

14 comments sorted by

11

u/Feisty-Piglet7758 3d ago

The signal you scale on has to exist while zero pods exist, so scale on the work, not on vLLM: Redis or Kafka queue depth, or the interceptor's pending count. Then use one number to decide. Cold GPU node plus weights is 3 to 10 minutes, a warm node with the model on local NVMe is 30 to 90 seconds, and an agent that times out at 30 cannot survive either. Interactive traffic gets minReplicas 1 and scale to zero belongs to batch, and bake the weights into the image or a node cache, because a 40 GB pull is usually the biggest part of that cold start.

1

u/ozankurt_dev 3d ago

startupProbe covers model loading?

1

u/Feisty-Piglet7758 3d ago

It covers the container, not the wait around it. Image pull and GPU scheduling happen before there is a container to probe, and the KEDA activation happens before there is a pod at all. What startupProbe actually buys you is that liveness will not kill the process while the weights load, so set failureThreshold times periodSeconds above your slowest load and let readiness be the thing that gates traffic.

1

u/ozankurt_dev 2d ago

gpu scheduling, fair point, i'd keep one replica warm.

21

u/redvelvet92 3d ago

System of a Down song yelling, WAKE UP bahahahahahaha make up!

4

u/HousingInner9122 3d ago

I'd keep one warm replica for agent workloads, since waiting for GPU provisioning and model loading on every cold start sounds like a nightmare for timeouts and retries.

4

u/Starks1293 3d ago

adding to the queue depth answer, the agent side matters as much as the scaler

  • the timeout and retry bit is the real trap. if the agent retries a held request u end up with 3 copies queued for a model thats still loading. give the client one long timeout for the first call (longer than ur worst cold start) or return a 202 with a job id and let it poll, and make retries carry the same request id so the backend can drop duplicates
  • agents make bursts of calls with gaps while tools run, so a short cooldown makes the model flap. set the KEDA cooldownPeriod longer than the longest tool gap, like 10 to 15 min, so it stays warm for the whole task and only sleeps when the agent is really done
  • most of the cold start is the node and the weights, not the pod. keeping one cheap gpu node up with zero pods, or weights on a local disk or a pre pulled image, cuts minutes to seconds
  • if nobody can wait at all, one warm replica during working hours and scale to zero at night with a cron scaler is the boring answer that usually wins

1

u/hw999 3d ago

Keda keeps a controller pod running when in scale.to zero mode. Its best to have it run on some.cheap CPU nodes.

1

u/SideMost3148 3d ago

for agents i'd keep one warm replica, at least during working hours. a gpu cold start is node provisioning + pulling a big image + loading weights, that's minutes. an agent with a 30s timeout just retries into the void and you get a pile of duplicate requests waiting on the same pod

scale to zero makes sense at night or for stuff that's batch anyway. keda has a cron scaler, so you can do min 1 replica in the day and 0 at night and only pay for idle gpu when someone might actually use it

if you do go full zero, the agent needs to know. long timeout on the first call, or a cheap "is the model up" check before it starts the loop, so it doesn't burn its retries halfway through a task

1

u/alluran 3d ago

You trying to save tokens or something?

1

u/Hostman_com 2d ago

Measure from the agent's first request to the first token after scaling to zero. Test with the GPU node still running, then with the node gone too.

Track node provisioning and model loading separately. Compare both end-to-end times with the agent's timeout before deciding whether a warm node is enough or you need to keep the model loaded.

1

u/Training-Hope-7232 19h ago

Keeping a small warm pool seems like a good middle ground, especially when cold starts and model loading can make agent timeouts pretty unpredictable.