Skip to content

fix(k8s): the gateway sends embeddings to every serving ollama tier, fastest first, so a rag batch never waits behind the slow tier #1987

Closed

Description

@dan-petty

Problem

The gateway sends every qwen3-embedding:0.6b request to one tier, ollama-48gib-slow. That tier has Pascal GPUs and runs the background model qwen3.8:27b at the same time. One RAG batch (32 chunks of 2,400 characters) takes 12 to 30 s there, and the RAG client stops waiting after 15 s.

Effects on 2026-10-23:

  • devops ai rag index . --force --include-kb stopped after 128 of 16,417 chunks with ReadTimeout. The devops_docs collection is empty.
  • Every devops roadmap intake failed in its duplicate check with EmbeddingsError ... ReadTimeout, so intake wrote nothing.

Evidence

The same warm batch on each tier, measured with /api/embed:

Tier Node GPUs Warm batch Embedder VRAM at 32,768 / 8,192 context
ollama-16gib 1 × 16 GiB 0.95 s 3.1 GB / about 2 GB
ollama-64gib 2 × 32 GiB 4.4 s 5.2 GB / about 2.5 GB
ollama-48gib-slow 2 × 24 GiB, Pascal 12 to 30 s 5.2 GB

Only ollama-48gib-slow held qwen3-embedding:0.6b. The interactive tiers keep one model loaded (OLLAMA_MAX_LOADED_MODELS=1, #1061), so an embedding request there evicts the loaded chat model. The task file of #1061 names this trade-off and leaves embedding placement to the gateway.

Proposed fix

  • Pull qwen3-embedding:0.6b onto every serving tier.
  • Give the gateway's qwen3-embedding:0.6b group one deployment per serving tier, with LiteLLM's order: the 48gib-fast and 64gib-standard tiers first, and the 16gib-fast and 48gib-slow tiers as fallbacks.
  • Send num_ctx: 8192 with each deployment. That is CONST_RAG_MAX_CHUNK_TOKENS, so no RAG chunk gets cut, and the embedder needs about half of its VRAM at 32,768.
  • Let each tier that the gateway sends embeddings to keep two models loaded. Ollama loads the second model only when both fit in VRAM, and otherwise unloads the idle one. OLLAMA_NUM_PARALLEL stays 1, so each KV cache holds one context (fix(k8s): every ollama tier keeps one model loaded and serves one request at a time, so its kv cache holds one context #1061).

Acceptance criteria

  • An offline test requires one embedding deployment per serving tier, with the order above and num_ctx at least CONST_RAG_MAX_CHUNK_TOKENS.
  • An offline test requires two loaded models on every tier that the gateway sends embeddings to, one on every other tier, and OLLAMA_NUM_PARALLEL=1 on all tiers.
  • After the merge and a gateway restart, devops ai rag index . --force --include-kb completes, and devops roadmap intake plans an item again.

Activity

  1. added
    type/bug
    scope/k8s
    on Oct 23, 2026
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

    scope/k8stype/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions