toolkitbox

~/ / AI articles / Local LLMs on a VPS / Watch the memory of Ollama on a small VPS

Watch the memory of Ollama on a small VPS

On a small server the memory is the limit, and Ollama keeps a model in memory after it has answered. This article shows how to see what is loaded, how long it stays, how many models and requests Ollama handles at once, and which settings change the memory use. Every default below is quoted from the official FAQ.

Published: · 3 min read · Facts checked against the official Ollama documentation on 2026-10-27. Defaults can change between versions, so check the FAQ of the version you run.

See what is loaded

The FAQ says to use ollama ps to see which models are currently loaded into memory. The PROCESSOR column tells where a model sits.

PROCESSOR showsWhat the FAQ says it means
100% GPUThe model was loaded entirely into the GPU.
100% CPUThe model was loaded entirely in system memory.
48%/52% CPU/GPUThe model was loaded partially onto both the GPU and into system memory.

On a VPS without a GPU, 100% CPU is the expected reading: the model sits in the memory of the server.

How long a model stays in memory

By default, the FAQ says, models are kept in memory for 5 minutes before they are unloaded. You can change that for the whole server, or for one request.

What you wantHow, according to the FAQ
Unload a model nowollama stop llama3.2
Keep a model loadedSend keep_alive with a negative number, for example -1, in a request to /api/generate or /api/chat.
Unload right after the answerSend keep_alive set to 0.
Another timekeep_alive also takes a duration string such as 10m or 24h, or a number of seconds such as 3600.
Set it for the whole serverSet the OLLAMA_KEEP_ALIVE environment variable when you start the server. It takes the same kinds of values. A keep_alive in a request takes precedence over it.

Our reading, not a statement from the documents: when the same server also runs other things, such as Dify or a chat screen, a model that stays loaded keeps its memory away from them. A shorter time frees memory sooner, and the next request has to load the model again. We did not measure how long that takes.

Several models, several requests

The FAQ describes three limits and one rule. If a new model does not fit in the available memory while other models are loaded, the new requests are queued until it can be loaded, and idle models are unloaded to make room.

The estimator below has a field for parallel requests, so you can see what a higher setting does to the total.

SettingWhat the FAQ says
OLLAMA_MAX_LOADED_MODELSThe maximum number of models that can be loaded concurrently provided they fit in available memory. The default is 3 times the number of GPUs, or 3 for CPU inference.
OLLAMA_NUM_PARALLELThe maximum number of parallel requests each model will process at the same time. The default is 1. Required RAM scales with OLLAMA_NUM_PARALLEL times OLLAMA_CONTEXT_LENGTH.
OLLAMA_MAX_QUEUEThe maximum number of requests Ollama queues when busy before it rejects more. The default is 512. Rejected requests get a 503 error.

Try it: Local LLM Memory Estimator

Model

Ollama tag qwen3:8b, quantization Q4_K_M, download size 5.2 GB.

Estimate

Model weights
4.84 GiB
KV cache
0.56 GiB
Reserve
1.00 GiB
Total
6.41 GiB (6.88 GB)
Smallest common memory size that holds it
8 GiB

This is an estimate. It does not include the runtime's compute buffers, and it assumes that every layer has the same KV shape. Measure a real run before you choose a plan.

Model data checked on 2026-10-26.

Sources: Ollama library · Model configuration (config.json) · Ollama FAQ

Everything runs in your browser. Nothing is uploaded.

Settings that change the memory use

SettingWhat the FAQ says
OLLAMA_CONTEXT_LENGTHBy default Ollama uses a context window of 4096 tokens. The environment variable overrides it, and num_ctx can be set per session or through the API.
OLLAMA_KV_CACHE_TYPEThe quantization type for the K/V cache. The default is f16.
OLLAMA_FLASH_ATTENTIONSet it to 1 when you start the server to force Flash Attention on. The FAQ says Ollama turns it on automatically when the backend and devices support it.

Environment variables of the server go into a systemd override. The article about installing Ollama on a VPS shows the steps. We did not measure how much memory each setting saves on your server, so check with ollama ps after a change.

Sources

Read next