Skip to content

feat(ai): devops ai gateway tune measures each inference backend and recommends routing weights #470

Closed

Description

@dan-petty

Problem

The gateway's routing config is tuned by hand. #467 found that devops-review held its largest server to about 2 concurrent requests and sent half of all review calls to the slowest servers. Fixing that meant measuring every backend, deriving weights, and editing the ConfigMap. Several values in the gateway config are hand-maintained and silently go stale when the cluster changes:

  • Throughput weights per deployment.
  • max_input_tokens, derived from each backend's context window (vLLM --max-model-len, Ollama OLLAMA_CONTEXT_LENGTH).
  • One gateway entry per Ollama replica. Today a test enforces this, but nothing generates the entries.

Proposal

Add devops ai gateway tune, delivered in slices:

  1. Measure and recommend (read-only, this issue's first PR)
    • Discover the model group's deployments from the gateway's /model/info, using the authenticated lookup from the routes fix.
    • Run a calibrated concurrency sweep against each backend directly, through the Kubernetes API proxy: a Service proxy for vLLM and a pod proxy for each Ollama pod. The same request goes through each backend's OpenAI-compatible API. The gateway cannot pin a request to one deployment: the ollama/* wildcard takes precedence, and deployment names are not unique.
    • Report each deployment's saturated throughput and latency, plus recommended weights in proportion to throughput. Add JSON output for automation.
    • Optionally, run the same sweep through the gateway, attributing each response by its x-litellm-model-id header, to compare the current weights with the recommended ones.
  2. Render: a diff of k8s/llm/gateway/configmap.yaml that updates weights, derives max_input_tokens from the backend manifests, and generates one entry per Ollama replica.
  3. Apply: with --apply, update the live ConfigMap, roll out the gateway, run the sweep again, and roll back if throughput drops.
  4. Continuous: re-tune when topology changes, for example a new Ollama replica or a changed model.

Acceptance criteria (slice 1)

  • devops ai gateway tune --model devops-review prints each deployment's measured throughput, latency and recommended weight, and changes nothing.
  • --json produces the same data machine-readably.
  • Unit tests cover discovery, the conversion from throughput to weights, and the mapping from backend URL to proxy path, without a cluster.

Activity

  1. added this to the v0.2.24 milestone on Sep 23, 2026
  2. added
    type/feature
    scope/ai
    scope/k8s
    priority/p2-medium
    on Sep 23, 2026
  3. modified the milestones: v0.2.24, v0.2.23 on Sep 24, 2026
  4. added 2 commits that reference this issue on Sep 24, 2026
    366054b
    79a3508
  5. dan-petty commented on Sep 24, 2026

    @dan-petty
    OwnerAuthor

    Closed by #484, merged into release/v0.2.23.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  6. added a commit that references this issue on Sep 28, 2026
    ea49d6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/aiscope/k8stype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions