~/ / 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 shows | What the FAQ says it means |
|---|---|
| 100% GPU | The model was loaded entirely into the GPU. |
| 100% CPU | The model was loaded entirely in system memory. |
| 48%/52% CPU/GPU | The 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 want | How, according to the FAQ |
|---|---|
| Unload a model now | ollama stop llama3.2 |
| Keep a model loaded | Send keep_alive with a negative number, for example -1, in a request to /api/generate or /api/chat. |
| Unload right after the answer | Send keep_alive set to 0. |
| Another time | keep_alive also takes a duration string such as 10m or 24h, or a number of seconds such as 3600. |
| Set it for the whole server | Set 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.
| Setting | What the FAQ says |
|---|---|
| OLLAMA_MAX_LOADED_MODELS | The 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_PARALLEL | The 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_QUEUE | The 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
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
| Setting | What the FAQ says |
|---|---|
| OLLAMA_CONTEXT_LENGTH | By 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_TYPE | The quantization type for the K/V cache. The default is f16. |
| OLLAMA_FLASH_ATTENTION | Set 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
- Connect Dify to Ollama on your own VPSRun Dify on your own VPS and use Ollama as its model: install, the plugin fields, the Docker address problem and embeddings, from the official documentation.
- Start a local LLM without an expensive PC: a beginner's guide to using a VPSNo powerful PC? Rent a VPS and run a small local LLM from your browser: six steps from memory estimate to a protected chat screen, with the limits stated honestly.
- Put nginx in front of Ollama: basic authentication, HTTPS and streaming settingsReach Ollama from outside safely: nginx as a proxy, basic authentication, HTTPS, streaming and timeout settings, and a firewall rule, from the official docs.
- Open WebUI on a VPS: run it in Docker and connect it to OllamaRun Open WebUI with Docker and connect it to Ollama on your own server: the commands, the first account, the two connection types and how to update.