Skip to content

Add support for weight-based load balancing in Olla #84

Open

Description

@Mahdi-A98

Proposed Feature:

Add a weight option for endpoints.

Weight could be applied to:

round_robin → classic weighted round-robin

least_conn → weighted least-connections

priority → within each priority tier, distribute traffic according to weight (two endpoint with same priority but different capacity)

Activity

  1. thushan commented on Nov 18, 2025

    @thushan
    Owner

    Thanks for the suggestion! Would love to know more about the usecase so we can make the implementation work well.

    • What's your current setup where you need weights? (eg. are you mixing GPU variations - H100 vs GB / RTX 6000 vs RTX 5090 etc)
    • What other differences are you trying to balance - network routing, links?
    • How are you currently working around this? (duplicating URLs, multiple instances, etc?)
    • Which load balancer are you using right now as your primary?

    I'm wondering whether based on your suggestion, if something like this (simplified) would work:

    endpoints:
            - url: "http://h200-node-1:8000"
              name: "primary-h200"
              type: "vllm"
              priority: 100
              weight: 400
    
            - url: "http://h100-node-1:8000"
              name: "h100-cluster-1"
              type: "vllm"
              priority: 100
              weight: 250 
    
            - url: "http://h100-node-2:8000"
              name: "h100-cluster-2"
              type: "vllm"
              priority: 100
              weight: 250
    
            - url: "http://l40s-rack-1:8000"
              name: "inference-l40s-1"
              type: "vllm"
              priority: 100
              weight: 100
    

    This is obviously hardware derived balancing.

  2. added
    enhancement
    roadmap-feature
    on Nov 18, 2025
  3. self-assigned this
    on Nov 18, 2025
  4. Mahdi-A98 commented on Nov 18, 2025

    @Mahdi-A98
    Author

    Thanks very much for considering this feature. In our setup, our product connects to multiple Ollama servers, and several of them run the same models. Since the servers have different hardware, capacities, and sometimes different network latencies, it would be really helpful to be able to assign a weight to each endpoint so traffic can be balanced according to their capabilities.

    We are currently in the development stage. I initially tried using duplicate URLs, but Olla only accepts the last duplicate. I then set up a reverse proxy with different domains, which worked and Olla distributed traffic equally between them. I also tried the LiteLLM load balancer, which uses latency-based balancing—but this approach sends all requests to the endpoint with the lowest latency, leaving others unused. Additionally, LiteLLM doesn’t support per-endpoint configuration.

    Also for our use case, having a load-balancer API (or administrative API) to dynamically add or remove endpoints would be extremely valuable.

    thank you.

  5. Mahdi-A98 commented on Nov 18, 2025

    @Mahdi-A98
    Author

    I also want to mention that the sample configuration you provided would work well for my setup.

  6. moschroe commented on Apr 2, 2026

    @moschroe

    For our use case, a combination of weights with #47 would be perfect. I work at a small company and we have not that many compute resources but would like to use what we have. An asymmetric distribution is the only fitting way to handle non-homogeneous HW.

    The ideal feature set I would like to have might look like this:

    • define weight per backend
    • provide preferences
      • 7B models on slower HW
      • large models on newer HW
      • preferences only rank eligible hosts, so fail-over can always happen
    • provide hard restrictions
      • not all machines have VRAM for large models
      • but all machines share a common storage location for downloaded files, so can "see" every available model
      • could be special case of preference score (or boolean flag hard: true), even preventing fail-over
    • have olla use information about loaded models to dispatch a request
      • if a system has the requested model loaded, prefer it as target
      • if system with model is busy and has a queue, dispatch onto idle system, if available

    Any logic keeping track of idle time, request queue and maximum expected queue time would need some tunable heuristics and hard limits to fall back onto well-defined behaviour.

  7. sg-shag commented on May 30, 2026

    @sg-shag

    I have a local oMLX use case that matches the loaded-model part of this issue.

    oMLX exposes GET /v1/models/status with per-model loaded, is_loading, actual_size, and last_access fields. In practice /v1/models means "available on disk / discoverable", while /v1/models/status tells whether the model is already resident in memory.

    The behavior I am after is:

    1. Filter endpoints using Olla's existing model routing strategy.
    2. If any compatible healthy endpoint already has the requested backend model loaded, choose least-connections among those hot endpoints.
    3. If none are hot, fall back to least-connections among all compatible endpoints and let the backend cold-load.
    4. For Olla model aliases, probe the endpoint-specific backend model id after alias resolution.

    I pushed a small proof-of-concept PR here: #152

    It adds an omlx-loaded-first balancer that probes /v1/models/status with a short cache, prefers hot endpoints, and falls back to regular least-connections on probe failure or cold candidates.

    This is intentionally narrow. If you would prefer a generic loaded-first balancer backed by provider-specific status collectors or registry state, I can rework the approach in that direction.

  8. ccsmart commented on Jun 3, 2026

    @ccsmart

    Just wanted to chime in "while at it".
    I think a similar thing is true with model aliases. Eg:

    The following would declare that upgrading is ok:

    models:

    • name: "qwen3.6:27b"
      aliases: ["qwen3.6:27b","qwen3.6:35b"]

    But you might want to have the upgrade considered as only if at 27b no server is available / all busy, that is higher priority of 27b.

    so maybe:

    models:

    • name: "qwen3.6:27b"
      aliases:
      • name: "qwen3.6:27b"
        weight: 20
      • name: "qwen3.6:35b"
        weight: 10
  9. ccsmart commented on Jun 15, 2026

    @ccsmart

    Meanwhile i believe that weight actually is not the right approach, as weight in the end always means at least a little bit everywhere. There is the proposal for "warm-first" #166 which i think is closer.... but maybe also complicated, not automatically achieving what's intended, as too many variables are at play, as mentionned including HW capabilities. It will probably just not warm up automatically the way the admin would prefer...
    Meanwhile i'm believing in the manual way to be a relatively low hanging fruit that in the end may even be better.
    As well i believe its core is tied with aliases. In the end as a proxy you intend to abstract.
    Assume all models are in principle available on all servers, servers have different capabilites... while you do want to benefit from reuse of already loaded models, not unnecessary purge/reload. Simple logic is trying in predefined sequence per model / alias. ie assume server1&2 to be beefier devices, server3&4 weaker:

    model_aliases:
    qwen3.6:35b:
    - "Qwen3.6-35B-A3B-MTP-GGUF"
    - "qwen3.6:35b"

    qwen3.6:27b:
    - "Qwen3.6-27B-MTP-GGUF"
    - "qwen3.6:27b"
    - "qwen3.6:35b"

    qwen3-reranker:8b:
    - "Qwen.Qwen3-Reranker-8B-GGUF-Q8_0"
    - "dengcao/Qwen3-Reranker-8B:q8_0"

    qwen3-embedding:8b:
    - "Qwen3-Embedding-8B-GGUF"
    - "qwen3-embedding:8b"

    model_prios:
    qwen3.6:35b:
    - server1
    - server2
    - server3
    - server4

    qwen3.6:27b:
    - server2
    - server1
    - server4
    - server3

    qwen3-reranker:8b:
    - server3
    - server4
    - server1
    - server2

    qwen3-embedding:8b:
    - server4
    - server3
    - server2
    - server1

    So a request comes in for model or alias, this time "qwen3-reranker:8b":

    • check server3
    • is it unavail or busy ?
      Y -> go to check server4
      N -> check model availability:
      - model "qwen3-reranker:8b" ?
      Y -> execute
      N -> iterate over backend models defined in alias
      - model unavail ? go to check server4

    ...
    autocheck as before on any servers that have not been part of the predefined sequence.

    If not manual, olla would have to be able to evaluate HW, map and prioritize it with models.

  10. ccsmart commented on Jun 15, 2026

    @ccsmart

    given the above, having priorities predefined and knowing the environment one could add an option to endpoints:

    discovery:
    type: "static"
    static:
    endpoints:
    - name: "server1"
    warmup_model: "qwen3.6:35b"

    this would on any transition of server1 from unhealthy to healthy issue 1 minimal request to server1 requesting model "qwen3.6:35b" so in best case it's always preloaded and can execute without delay even on the first user request.

  11. ccsmart commented on Jun 15, 2026

    @ccsmart

    another variant might be extending set of applicable servers with delay.

    model_prios:
    qwen3.6:35b:

    • servers:
      • server1
      • server2
        wait: 3
    • servers:
      • server3
      • server4
        wait: 2

    such that on arrival of the request, servers 1&2 are tried. on events like task completion and trigger for schedule & timeout check. if time passed since user request >5s, servers 3&4 are appended to the list.
    seconds 0-3: servers 1&2 are tried
    seconds 3-5: servers 1-4 are tried
    seconds 5-timeout: servers 1-4 & any not listed are tried

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementroadmap-feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions