How much RAM do I need for a VPS? The rule, workload by workload

Memory is what most often decides the size of a server. It runs out first, and when it does, the server does not slow down gracefully: it kills processes. This guide gives the sizing rule, what each part of an application actually uses, typical profiles, and how to measure a server that is already running.

Published on 15 October 2026 By 9-minute read

All guides

In short

  1. Add up everything that stays resident: the operating system, the web server, every application process, the database and the cache.
  2. Size for the peak, not the average: a build, a backup or a scheduled job can double memory use for a few minutes.
  3. Add 25% headroom. Memory left free becomes disk cache, which speeds up your database.
  4. On a running server, read the available column of free -h, not the free column.
  5. When memory runs out, Linux kills a process, often the largest one: the database. A service that restarts on its own is the first warning sign.
  6. Pick a size you can grow out of without reinstalling: an application in production needs more as its data grows.

The rule: add up what stays in memory

A server does not use memory "in general": every running program holds on to its share for as long as it runs. So the calculation starts from the list of processes that will always be there, then adds the peak and some headroom:

RAM to plan for = (OS + always-on services + peak of occasional jobs) × 1.25

What each component uses

The figures below hold for a typical application, measured in production. They are a starting point; measuring your own application, as described further down, always has the final word.

ComponentTypical memoryWhat makes it vary
Nginx, Caddy (web server, reverse proxy)10 to 50 MBAlmost flat: connection count barely matters.
PHP-FPM (WordPress, Laravel, Symfony)40 to 80 MB per processThe number of processes, capped by pm.max_children: 10 processes means 400 to 800 MB.
Node.js (API, Next.js, NestJS)60 to 300 MB per processThe number of processes (cluster mode, PM2) and the heap size, capped by --max-old-space-size.
Python (Django, FastAPI, Flask)80 to 200 MB per processThe number of Gunicorn or Uvicorn workers, and the libraries loaded: pandas or a machine learning model add hundreds of MB.
Java (Spring Boot)300 MB to 1 GB per applicationThe maximum heap size: by default, the JVM takes a quarter of the memory it can see.
Go, Rust10 to 100 MBWhatever data the application itself keeps in memory.
PostgreSQL25% of RAM for shared_buffers, plus a few MB per connectionHow much data is read often, the number of connections, work_mem.
MySQL, MariaDBinnodb_buffer_pool_size, 128 MB by defaultOn a dedicated database server, this buffer commonly takes up to 80% of memory.
RedisThe size of the data, plus its data structuresWhile saving to disk, modified pages are duplicated: up to twice the memory in the worst case.
Elasticsearch, OpenSearchAt least 2 GB of heapThe heap stays under half of RAM: the rest serves as file cache.

One peak catches JavaScript projects again and again: the build. npm run build on a Next.js, Nuxt or Angular project commonly needs 1 to 2 GB on its own for a few minutes, on top of everything already running. Building on the server means sizing for that peak; building on your machine or in CI and shipping only the output avoids it.

The same reasoning applies to Docker containers: each container is a set of ordinary processes, and the Docker daemon adds its own share. docker stats shows what each one takes.

Typical profiles

These profiles add up the components above, peak and headroom included. They assume an application of ordinary size and launch-day traffic; a large database or sustained traffic pushes the figure up.

What runs on the serverMemory to plan for
Static site, reverse proxy, small bot or scheduled script1 to 2 GB
One WordPress site with MariaDB and a page cache2 GB
A WooCommerce shop, or several WordPress sites4 GB
A Node.js or Python API with PostgreSQL, first users4 GB
A Next.js app built on the server, with its API and a PostgreSQL database6 to 8 GB
Several containerized applications, staging and production8 GB
A database of several tens of GB under heavy read load16 GB and up
A 7 to 8 billion parameter language model running on the server16 GB

An application that calls an AI model through an API (OpenAI, Anthropic, Mistral) is sized like any web application: the model runs at its provider and your server waits for the answer. Running the model on the server itself is what changes the scale.

Measuring a live server

On a server in production, measurement replaces estimates. Three commands tell you where you stand:

Terminal
free -h
ps aux --sort=-rss | head -n 15
vmstat 5 5

Measure at the busiest time of day, and during occasional jobs: builds, backups, imports. The peak is what counts.

When memory runs out

A server that runs out of memory does not degrade gradually. When there is nothing left to reclaim, the Linux kernel calls the OOM killer (out of memory): it picks a process, usually the one holding the most memory, and kills it outright. On an application server, that is often the database.

The symptoms: intermittent 502 or 503 errors, a service that restarts for no visible reason, a build that dies with Killed. The logs confirm it:

Terminal
journalctl -k | grep -i "out of memory"
systemctl status your-service

In the output of systemctl status, Failed with result 'oom-kill' marks a service stopped for lack of memory.

Swap, when the server has it, delays that moment by moving the least used memory to disk. It is a safety net, not capacity: a server that leans on swap all the time responds several times slower, even on an NVMe SSD.

The fixes, from quickest to most lasting: fewer application processes (pm.max_children, Gunicorn workers), builds moved off the server, a memory cap on the database, then a larger size.

Choosing a size, and planning ahead

  1. List what will run: web server, application and its number of processes, database, cache, scheduled jobs.
  2. Add them up with the component table, add the heaviest peak (often the build), then 25% headroom.
  3. Pick the size that covers that total. Between two neighbouring sizes, the smaller one is fine as long as moving up does not mean reinstalling.
  4. Measure after launch, at the daily peak, then again at each growth step of the application.

Memory is not the only resource: CPU matters for anything that computes (builds, image processing, running an AI model) and disk for the database and files. For a web application, though, it is almost always memory that sets the size.

The right size, and the freedom to change it

VPS Pro comes in six sizes, on Intel Xeon processors, ECC memory and mirrored NVMe SSDs, and moves up to a larger size at any time without reinstalling. Full-Stack Assistance is included: tell us what your server will run and we recommend the size, then we diagnose every question and tell you what to do, from the operating system down to your application code.

Explore VPS Pro

Frequently asked questions

How much RAM does a small VPS need?

A static site, a reverse proxy or a small script runs in 1 to 2 GB. As soon as a database and an application (PHP, Node.js, Python) share the server, plan for 2 GB for a WordPress site and 4 GB for a custom application with PostgreSQL.

How much RAM for WordPress on a VPS?

2 GB for one site with MariaDB and a page cache, 4 GB for a WooCommerce shop or several sites. The number of PHP-FPM processes is the first setting to look at: each one holds 40 to 80 MB.

Can swap replace RAM?

No. Swap prevents an abrupt crash when memory is full, but a server that relies on it all the time responds several times slower, even on an NVMe SSD. It is a safety net; the size is chosen on memory.

Why does free show almost no free memory?

Because Linux uses unused memory as file cache. That cache is released as soon as a program needs memory. The column to read is available, which shows the memory really available.

How much RAM to build a Next.js app?

Allow 1 to 2 GB for the build alone, on top of what already runs on the server. Building on your machine or in CI and deploying only the output avoids that peak.

Contact us