How it works
Every response from the load balancer includes anX-Runpod-Worker-Id header that identifies the worker that handled the request:
Affinity modes
Soft affinity
- Routes to the specified worker if available.
- Falls back to normal worker selection if the worker is unavailable, at capacity, or not found.
- Never fails a request due to affinity — this mode is best-effort.
Strict affinity
- Routes only to the specified worker.
- If the worker is at capacity, the request waits up to ~5 minutes.
- If the worker does not free up in time, returns
400with reasontimed out waiting for worker. - If the worker is gone, returns
404with reasonaffinity_worker_gone. - Use this mode when falling back to a different worker would produce incorrect results.
Strict-resume affinity
- Same as strict, but also resumes a scaled-down worker before routing.
- If the resume cannot complete immediately, it keeps retrying while the request waits.
- Returns
400on timeout, or404if the pod is truly gone (terminated or redeployed under a new ID). - Cross-endpoint access is not possible.
strict-resume keeps a worker running as long as requests keep coming in. Workers scale down after being idle (no requests) for a set period. If your client sends a request before that idle period expires, the timer resets and the worker stays up. This means a worker receiving regular traffic, with or without strict-resume, will never scale down.
When your session is done, send your next request without the
X-Runpod-Worker-Id header so the worker is no longer pinned and can go idle.Worker ID on responses
The load balancer always setsX-Runpod-Worker-Id on the response to reflect the worker that actually served the request. Use the value from the response header for pinning rather than tracking it separately.