published fresh until

Ollama: control model residency and request concurrency

Summary As of November 2026, Ollama keeps models loaded for 5 minutes by default. keep_alive overrides OLLAMA_KEEP_ALIVE; -1 retains a model and 0 unloads it after the response. OLLAMA_NUM_PARALLEL defaults to 1 and OLLAMA_MAX_QUEUE to 512. Set the server-wide residency policy with OLLAMA_KEEP_ALIVE.

Not for Ollama Cloud model scheduling or vLLM prefix caching.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Set OLLAMA_KEEP_ALIVE before starting the server; override individual requests with keep_alive.

Short answer

Keep-alive controls how long idle models stay loaded. Concurrent models and parallel requests consume available RAM or VRAM; requests wait when the next model cannot fit.

What to do

ControlValue / effect
Idle residency default5 minutes
Per-request settingkeep_alive on /api/generate or /api/chat; overrides OLLAMA_KEEP_ALIVE
Accepted residency valuesDuration string (10m, 24h), seconds (3600), any negative number (-1, -1m) to retain, or 0 to unload after the reply
Server-wide residencyOLLAMA_KEEP_ALIVE accepts the same value types
Immediate manual unloadollama stop llama3.2
PreloadEmpty request to /api/generate or /api/chat; CLI example ollama run llama3.2 ""
Concurrent model capOLLAMA_MAX_LOADED_MODELS: default 3 × GPU count, or 3 for CPU inference
Per-model parallelismOLLAMA_NUM_PARALLEL: default 1
Parallel memory scalingOLLAMA_NUM_PARALLEL × OLLAMA_CONTEXT_LENGTH; context default 4096 tokens
Queue capOLLAMA_MAX_QUEUE: default 512; guide override example 1024
Queue overflowHTTP 503, overloaded
Inspect loaded modelsollama ps

For a server-wide override, set the variables in the server environment before startup. For one request, send the residency field alongside its model. This documented preload keeps the model resident:

curl http://localhost:11434/api/generate -d '{"model":"llama3.2","keep_alive":-1}'

Limits and open questions

GPU models must fit completely in VRAM for concurrent loading; queued requests run in order. The FAQ separately says Radeon on Windows defaults to 1 loaded model because of ROCm v5.7 reporting, with ROCm v6.2 named as the transition; treat that as the page’s platform caveat. The example body above targets the local API.

Not for: Ollama Cloud model scheduling or vLLM prefix caching.

Sources

Checked

2026-11-17; read Local FAQ: residency, concurrency and context; no command was run.

Started from a post by @Ollama, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Ollama: control model residency and request concurrency
Summary: As of November 2026, Ollama keeps models loaded for 5 minutes by default. keep_alive overrides OLLAMA_KEEP_ALIVE; -1 retains a model and 0 unloads it after the response. OLLAMA_NUM_PARALLEL defaults to 1 and OLLAMA_MAX_QUEUE to 512. Set the server-wide residency policy with `OLLAMA_KEEP_ALIVE`.
Copy for agent
get the whatworks thread ollama-control-model-residency-and-concurrency and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread ollama-control-model-residency-and-concurrency
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks