Two people ask your Ollama server a question at the same time, and one of them waits. Or an agent fires off five requests and they crawl through one by one. Or you get a 503 error when a script gets busy.
All of these come down to how Ollama handles concurrent requests, and a few server settings control it.
This guide explains how Ollama queues and runs parallel requests, and what OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE do. It covers how much extra memory parallel requests cost and which values to pick for one user, a small team or an agent workload.
OLLAMA_NUM_PARALLEL: how many requests one model handles at the same time. On most current setups the default is 1, so others wait in a queue.OLLAMA_MAX_LOADED_MODELS: how many different models can stay loaded together. The default is 3 per GPU, or 3 on CPU.OLLAMA_MAX_QUEUE: how many requests can wait before Ollama returns a 503. The default is 512.- Cost: each parallel slot adds a full context of memory. 4 slots with an 8K context use memory like a 32K context.
- Typical picks: 1 for one person, 2-4 for a small team, 4-8 for agents on a big GPU.
New to Ollama? My Ollama guide covers install, models, commands and fixes in one place.
How Ollama Handles Concurrent Requests
Ollama’s FAQ describes two levels of concurrency:
- Several models loaded at once. If there is enough memory (VRAM for GPU, RAM for CPU), different models can stay loaded side by side and answer requests at the same time.
- Several requests to one model. If there is enough memory when a model loads, Ollama sets it up to process more than one request in parallel.
When a request needs a model that is not loaded and there is no room, Ollama queues it. As loaded models go idle, Ollama unloads one or more of them to make room, then works through the queue in order. With GPUs, a new model must fit completely in VRAM to load alongside the others.
Requests beyond the parallel limit for a model also wait in the queue. That is why a second user sees no output until the first answer finishes: the model is set to one request at a time.
The Three Settings
| Variable | What it controls | Default |
|---|---|---|
OLLAMA_NUM_PARALLEL |
Max requests each loaded model processes at the same time | 0 = backend default. That is 1 on most backends; MLX on Apple Metal picks a value from free memory |
OLLAMA_MAX_LOADED_MODELS |
Max different models loaded together, if they fit | 3 × number of GPUs, or 3 on CPU |
OLLAMA_MAX_QUEUE |
Max requests waiting before new ones are rejected with 503 | 512 |
A note on older guides: earlier Ollama versions picked 4 or 1 parallel slots automatically, based on free memory. The current docs say other backends default to 1 unless you set a value. If you want parallel requests, set OLLAMA_NUM_PARALLEL yourself instead of relying on the automatic choice.
Another exception from the docs: Windows with Radeon GPUs has defaulted to 1 loaded model because of ROCm VRAM reporting limits. You can raise it, but make sure the models really fit.
Memory Cost of Parallel Requests
This is the part most people miss. Ollama’s docs say parallel processing multiplies the context: a 2K context with 4 parallel requests becomes an 8K context, with the extra memory that needs.
So with num_ctx 8192 and OLLAMA_NUM_PARALLEL=4, the KV cache is sized like a 32K context. On a card that only just fits the model, that can push part of it onto the CPU and make every request slower.
Ways to make room for more slots:
- Quantize the KV cache:
OLLAMA_KV_CACHE_TYPE=q8_0uses about half the memory of the defaultf16, usually with no noticeable quality loss.q4_0uses about a quarter, with more loss at long contexts. It is a global setting, and it needs Flash Attention, which current Ollama turns on automatically where supported (OLLAMA_FLASH_ATTENTION=1forces it). - Use a smaller context per request if your prompts are short. Chat apps rarely need 32K per user.
- Use a smaller quantization of the model to free VRAM for the cache.
After a change, check ollama ps. If the PROCESSOR column changed from 100% GPU to a CPU/GPU split, you asked for too many slots or too much context. My Ollama context length guide explains the context side in detail.
How to Set Them
These are server settings. Set them where the Ollama server starts, then fully restart it.
Windows app: quit Ollama from the tray. Add user environment variables, then start Ollama again:
setx OLLAMA_NUM_PARALLEL "4"
setx OLLAMA_MAX_LOADED_MODELS "2"
setx OLLAMA_KV_CACHE_TYPE "q8_0"
macOS app:
launchctl setenv OLLAMA_NUM_PARALLEL 4
Then quit and reopen Ollama. launchctl setenv is lost after a reboot.
Linux (systemd):
sudo systemctl edit ollama.service
[Service]
Environment="OLLAMA_NUM_PARALLEL=4"
Environment="OLLAMA_MAX_LOADED_MODELS=2"
Environment="OLLAMA_MAX_QUEUE=1024"
sudo systemctl daemon-reload
sudo systemctl restart ollama
Docker:
docker run -d --gpus=all -e OLLAMA_NUM_PARALLEL=4 -e OLLAMA_KV_CACHE_TYPE=q8_0 -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
Quick test from a terminal (Linux/macOS), after stopping the app or service:
OLLAMA_NUM_PARALLEL=4 ollama serve
Every server variable is explained in my Ollama environment variables guide.
Test Parallel Requests
Send four requests at the same time and watch whether they stream together or one after another. A short Python script using the official library’s async client:
import asyncio, time
from ollama import AsyncClient
async def ask(i):
t = time.time()
r = await AsyncClient().chat(model='llama3.1', messages=[
{'role': 'user', 'content': f'Write two sentences about the number {i}.'}])
print(i, round(time.time() - t, 1), 's')
async def main():
await asyncio.gather(*(ask(i) for i in range(4)))
asyncio.run(main())
With OLLAMA_NUM_PARALLEL=1, the times climb step by step (for example 3 s, 6 s, 9 s, 12 s) because each request waits for the one before. With 4 slots, all four finish at around the same time.
Each one is a bit slower than a single request on its own, but the total wait is much shorter. More on the library: Ollama Python guide.
Or from a shell, using background jobs:
for i in 1 2 3 4; do
curl -s http://localhost:11434/api/generate -d '{"model":"llama3.1","prompt":"Say hi","stream":false}' > /dev/null &
done; time wait
Which Values to Use
| Use case | NUM_PARALLEL | MAX_LOADED_MODELS | Notes |
|---|---|---|---|
| Just you, chatting | 1 | default | Max speed and context for one request |
| You + a coding tool or RAG app | 2 | 2 | Chat and an embedding model can stay loaded together |
| Family or small team on Open WebUI | 2-4 | 2 | Use q8_0 KV cache; keep context at 8K-16K |
| Agents, batch jobs, n8n workflows | 4-8 | 1-2 | Best on 24 GB+ VRAM with a small or mid model |
| Many users, production | – | – | Look at vLLM or llama-server, which are built for high-concurrency serving |
Start low, raise one step at a time, and check ollama ps after each change. For heavy serving, see vLLM vs llama.cpp vs Ollama and my llama-server guide.
Running Several Models at Once
A very common setup is a chat model plus an embedding model for RAG. If they can’t both stay loaded, every search makes Ollama unload the chat model, load the embedder, and then swap back. That adds seconds to every answer.
To avoid this:
- Make sure both fit in VRAM together (an embedding model is usually small).
- Keep
OLLAMA_MAX_LOADED_MODELSat 2 or more. - Keep them loaded longer with
OLLAMA_KEEP_ALIVE(for example30m). See Ollama keep alive.
With two GPUs, Ollama’s default allows 6 loaded models. It can also keep one model per card. My Ollama multi-GPU guide shows how to pin models to GPUs.
Throughput vs Speed per Request
Parallel requests trade a little speed per request for much more total output:
- Single request: fastest tokens per second for that one user.
- Several parallel requests: each stream is somewhat slower, but the GPU produces more tokens in total, so everyone gets an answer sooner than if they waited in line.
If one person mostly uses the server, keep it at 1 so their answers are as fast as possible. If several tools or people share it, 2-4 slots usually feel much better, because nobody stares at a blank screen while someone else’s long answer streams.
Troubleshooting
Requests still run one at a time
The variable probably isn’t reaching the server. Quit the app fully (tray icon, then Quit), or restart the service, and check the server log at start-up. Ollama prints a “server config” line there, which lists the value of OLLAMA_NUM_PARALLEL it actually picked up. Also check that your client isn’t sending requests one by one itself.
503 “server overloaded”
The queue is full. Raise OLLAMA_MAX_QUEUE, add parallel slots, or slow the sender down with a retry and backoff.
Everything got slower after raising NUM_PARALLEL
The bigger KV cache pushed part of the model to the CPU. Run ollama ps. If it shows a CPU/GPU split, lower the slots or context, or set OLLAMA_KV_CACHE_TYPE=q8_0.
Models keep unloading and reloading
They don’t fit together, or OLLAMA_MAX_LOADED_MODELS is too low. Use smaller models, or accept the swap and raise keep-alive for the main model. The Ollama logs show each load and unload.
FAQ
Is OLLAMA_NUM_PARALLEL per model or for the whole server?
Per model. Each loaded model can handle that many requests at once.
Can I set parallel slots for just one model?
Not today. It is a server-wide setting. If you need different limits, run two Ollama servers on different ports with different settings.
Do parallel requests share context with each other?
No. Each slot has its own context, so users don’t see each other’s conversations. That is also why each slot costs its own memory.
What happens on a CPU-only machine?
The same rules apply, using system RAM. Parallel requests on CPU share the same cores, so total speed improves less than on a GPU.
Does Open WebUI need special settings?
No. Open WebUI just sends requests to Ollama. Set the variables on the Ollama server. See Open WebUI with Ollama, and for team access from other devices, access Ollama from another computer.
Sources
- Ollama docs: FAQ (concurrent requests, context multiplied by parallel slots, defaults for NUM_PARALLEL, MAX_LOADED_MODELS and MAX_QUEUE, 503 overloaded, Radeon on Windows, Flash Attention and KV cache types)
- Ollama source: envconfig (variable names and defaults)
- ollama-python (AsyncClient)




