feat(selfhost): tune Ollama concurrency for a shared embed+vision GPU (#4327) - #4352
Merged
Conversation
…#4327) Ollama had no concurrency/residency configuration -- all defaults, including OLLAMA_MEM_LIMIT still sized for a single embedding model only (8g). Adds OLLAMA_NUM_PARALLEL/OLLAMA_MAX_LOADED_MODELS/ OLLAMA_KEEP_ALIVE (mirroring the existing OLLAMA_MEM_LIMIT override pattern) and raises the memory ceiling to 20g, sized for an embed model + one vision model resident and concurrently in use on a single 24GB-class GPU without either starving the other under a busy queue. See docker-compose.yml's comment on the ollama service for the full VRAM/KV-cache reasoning.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4352 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 399 399
Lines 36786 36786
Branches 13440 13440
=======================================
Hits 34561 34561
Misses 1569 1569
Partials 656 656 🚀 New features to boost your workflow:
|
10 tasks
12 tasks
JSONbored
added a commit
that referenced
this pull request
Jul 9, 2026
…#4369) The self-host Ollama concurrency tuning (#4327/#4352) sized VRAM headroom assuming a bounded per-request context; vision calls had no num_ctx cap, so under concurrent load a large context is the real OOM/thrashing risk on a shared embed+vision GPU. Adds a generic providerOptions passthrough on the OpenAI-compatible chat path (Ollama-specific request extension, ignored by every other provider) and sets num_ctx: 4096 on the self-host visual-vision call.
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OLLAMA_MEM_LIMIT(container RAM ceiling, not VRAM) was still sized for a single embedding model only (8g).OLLAMA_NUM_PARALLEL/OLLAMA_MAX_LOADED_MODELS/OLLAMA_KEEP_ALIVE, mirroring the existingOLLAMA_MEM_LIMITenv-override pattern, and raises the memory ceiling to20g— sized for an embed model + one vision model resident and concurrently in use on a single 24GB-class GPU without either starving the other under a busy review queue.ollamaservice indocker-compose.ymlfor the full VRAM/KV-cache reasoning (worst-case ~14-15GB of 24GB at these defaults).Closes #4327 -- all 5 deliverables satisfied: GPU passthrough confirmed (nvidia-smi + docker inspect device reservation), before/after latency numbers posted to the issue, a batch-size recommendation shipped (#4350), and this PR promotes the previously-local-only compose changes into the tracked repo now that cutover has happened. Companion to #4350, both stemming from the GPU-migration epic #4325.
Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(vianpm run test:ci)npm run typecheck(vianpm run test:ci)npm run test:coveragelocally — new structural assertions added totest/unit/selfhost-compose-resource-limits.test.tsnpm run test:workers(vianpm run test:ci)npm run build:mcp/npm run test:mcp-pack(vianpm run test:ci)npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build(vianpm run test:ci) — no UI/API surface touchednpm audit --audit-level=moderate— 0 vulnerabilitiesdocker-compose.yml's ollamaenvironment:block and.env.exampledocumentation are both asserted directly (mirroring this file's existing memory-limit test pattern)Ran
npm run test:ci(full unsharded suite) end-to-end — green.Safety
UI Evidencesection. — N/A, no UI change..env.exampledocuments every new var).Notes
cf-typegenregeneration needed —docker-compose.yml/.env.examplearen't scanned by any of those generators.