You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a backend-agnostic warm-first load balancer that prefesrs endpoints where the requested model is already resident in memory, avoiding cold-load latency (10-30s weight load + possible LRU eviction) on multi-model backends.
This generalises the backend-specific approach proposed in #152 into a strategy that works across any backend able to report model residency.
Backend
Source
Notes
oMLX
GET /v1/models/status (loaded: bool)
multi-model
Ollama
GET /api/ps
multi-model
LM Studio
JIT model state
hot/cold
vLLM / SGLang / llama.cpp
single-model
always warm
The warm-first balance would wrap something like sticky( warmFirst( baseBalancer ) ) and something high-level like this:
Select(candidates, requestedModel):
warm = [e for e in candidates if residency.IsResident(e, requestedModel) == (true, true)]
if warm is non-empty:
return base.Select(warm, requestedModel) # delegate within warm set
return base.Select(candidates, requestedModel) # nobody warm → normal behaviour
I think the problem will be on fresh start.
eg a pair of strong and a pair of weaker servers, but all are strong enough for all models, just slower on the weaker ones. weaker ones are supposed to be fallback for heavy model request overload on the stronger servers. eg 2 heavy models for chat, 1 for embedding, 1 for rerank. you'd want embedding and rerank on the lighter ones, one of the chat models on the stronger ones each.
but initial requests after starting up the system may distribute and stick the wrong way round.
i think automations here will quickly get complex and always have different opinions on what is right,
imo low hanging fruit, manual priorities as in #84
Expected behavior with balancer - all requests go to one node.
Right?
Not exactly. The practical expectation for us is narrower:
requests with the same sticky key should keep going to the same node while that sticky mapping is alive
not all requests globally going to one node
What ended up working for us in Thunder Forge / oMLX was a very simple setup:
auth is implemented on the frontend / edge
the edge forwards Authorization to Olla
if the client already has a sticky session header, the edge forwards that too
Olla sticky sessions use:
session_header first
auth_header second
That gives us a KISS split of responsibilities:
X-Olla-Session-ID for explicit conversation/session stickiness and KV-cache locality
Authorization as the fallback sticky key for clients that do not send a session header
One important frontend detail: the edge must not invent a new session id on every request. We had that bug for a while, and it prevented auth_header fallback from ever being used. Once we changed the edge to only forward X-Olla-Session-ID when the client actually sent one, this started behaving correctly.
Warm-first / KV-resident-aware balancing is the right instinct. GateLLM pairs weighted load balancing with sticky session affinity so repeated turns pin to the same upstream and keep prompt-cache locality, plus health checks to skip cold or failed endpoints. Same idea, applied across any backend.
Activity
bongiozzo commentedon Jun 7, 2026
4 requests in one session of opencode to freshly restarted thunder-forge (olla/omlx) cluster
first request touched msm3 and msm2 nodes simultaneously with significant delay for loading.
second, third and forth gone to msm1 and were fast
Generated Olla config:
Expected behavior with balancer - all requests go to one node.
Right?
ccsmart commentedon Jun 16, 2026
I think the problem will be on fresh start.
eg a pair of strong and a pair of weaker servers, but all are strong enough for all models, just slower on the weaker ones. weaker ones are supposed to be fallback for heavy model request overload on the stronger servers. eg 2 heavy models for chat, 1 for embedding, 1 for rerank. you'd want embedding and rerank on the lighter ones, one of the chat models on the stronger ones each.
but initial requests after starting up the system may distribute and stick the wrong way round.
i think automations here will quickly get complex and always have different opinions on what is right,
imo low hanging fruit, manual priorities as in #84
sg-shag commentedon Jun 17, 2026
Not exactly. The practical expectation for us is narrower:
What ended up working for us in Thunder Forge / oMLX was a very simple setup:
Authorizationto Ollasession_headerfirstauth_headersecondThat gives us a KISS split of responsibilities:
X-Olla-Session-IDfor explicit conversation/session stickiness and KV-cache localityAuthorizationas the fallback sticky key for clients that do not send a session headerOne important frontend detail: the edge must not invent a new session id on every request. We had that bug for a while, and it prevented
auth_headerfallback from ever being used. Once we changed the edge to only forwardX-Olla-Session-IDwhen the client actually sent one, this started behaving correctly.Current generated Olla config excerpt:
So for now, for our use case, this has been enough:
That is simple, understandable, and good enough for balancing today, without adding more routing policy yet.
aggieturing-code commentedon Sep 4, 2026
Warm-first / KV-resident-aware balancing is the right instinct. GateLLM pairs weighted load balancing with sticky session affinity so repeated turns pin to the same upstream and keep prompt-cache locality, plus health checks to skip cold or failed endpoints. Same idea, applied across any backend.