This site contains affiliate links. If you purchase through them I may earn a commission at no extra cost to you. Full disclosure.
The short answer: 2 GB is the practical minimum for a self-hosted stack with more than one service. 4 GB gives you comfortable headroom for a database, an app, a reverse proxy, and Docker. Below 2 GB you will be juggling swap and crossing your fingers.
"RAM is the single bottleneck that decides whether your self-hosted setup feels snappy or sluggish. CPU matters for builds; RAM decides how many things you can run at once."
Marketing pages list system requirements in a vacuum. Here is what these services actually consume on a small VPS after they have been running for a few hours:
| Service | Idle RAM | Under Load | Notes |
|---|---|---|---|
| Ubuntu / Debian base | 80–150 MB | 150–200 MB | Includes SSH, cron, syslog |
| Nginx (reverse proxy) | 10–30 MB | 30–80 MB | Scales with worker connections |
| Caddy | 20–50 MB | 50–100 MB | Slightly heavier than Nginx, auto-TLS included |
| Node.js app (small) | 80–200 MB | 200–500 MB | Depends heavily on app complexity |
| PostgreSQL | 80–150 MB | 200–400 MB | Shared_buffers defaults to ~128 MB |
| SQLite | 5–20 MB | 20–80 MB | Great for single-app setups |
| Redis | 10–30 MB | 30–100 MB | Scales with dataset size |
| Docker daemon | 30–50 MB | 50–100 MB | Overhead per container is small |
| OpenClaw | 150–300 MB | 300–600 MB | Node-based; depends on active agents |
Add up the idle numbers for everything you plan to run simultaneously, then add 200–400 MB for OS overhead and buffers. That is your realistic minimum.
OS base: 120 MB
Nginx: 25 MB
Node.js app: 150 MB
SQLite: 15 MB
─────────────────────────
Total idle: 310 MB
+ headroom: 200 MB
─────────────────────────
Comfortable at: 512 MB (tight) → 1 GB (safe)
OS base: 150 MB
Caddy: 40 MB
Node.js app: 250 MB
PostgreSQL: 150 MB
Redis: 30 MB
Docker overhead: 50 MB
OpenClaw: 250 MB
─────────────────────────
Total idle: 920 MB
+ headroom: 400 MB
─────────────────────────
Comfortable at: 1.3 GB → 2 GB (safe) → 4 GB (room to grow)
OS base: 150 MB
Traefik: 60 MB
App 1 (Node): 300 MB
App 2 (Python): 200 MB
PostgreSQL: 250 MB
Redis: 50 MB
Docker overhead: 100 MB
Monitoring: 100 MB
─────────────────────────
Total idle: 1,210 MB
+ headroom: 500 MB
─────────────────────────
Comfortable at: 1.7 GB → 4 GB (safe)
Swap is disk space that the OS uses when RAM fills up. It prevents OOM kills but makes everything slower — reading from disk is roughly 100x slower than reading from RAM.
Always set up a swap file on a small VPS. It costs nothing and can save you from a midnight outage:
# Create a 2 GB swap file
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
# Make it permanent
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# Verify
free -h
Tune swappiness so the kernel prefers real RAM and only touches swap under pressure:
# Lower = prefer RAM, higher = more aggressive swapping
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.d/99-swappiness.conf
A swappiness of 10 means the kernel will keep using RAM until it is nearly full, then swap as a last resort. The default of 60 is too aggressive for VPS workloads.
Do not guess — measure. These commands tell you exactly where you stand:
# Quick snapshot
free -h
# Live monitoring (press q to quit)
htop
# Check for OOM kills (these mean you ran out of RAM)
dmesg | grep -i "out of memory" | tail -5
# Per-process RAM usage, sorted by highest
ps aux --sort=-%mem | head -15
# Swap usage detail
swapon --show
Watch for these red flags:
Before throwing money at a bigger plan, check whether your setup is wasting RAM:
shared_buffers and work_mem on small VPS instancesNODE_OPTIONS=--max-old-space-size=512 caps memory per processsystemctl list-units --type=service --state=running to auditStarting fresh? The Hostinger KVM 1 plan (1 vCPU / 4 GB RAM) is enough for most beginner self-hosting setups. If you know you will run Docker with multiple services, jump straight to KVM 2 (2 vCPU / 8 GB RAM) — the price difference is small compared to the hassle of migrating later.
| Use Case | Minimum | Recommended |
|---|---|---|
| Static site or single lightweight app | 512 MB | 1 GB |
| WordPress or small CMS + DB | 1 GB | 2 GB |
| App + database + reverse proxy | 1.5 GB | 2–4 GB |
| Docker with 2–4 containers | 2 GB | 4 GB |
| Full self-hosted stack (5+ services) | 4 GB | 8 GB |
| CI/CD or build server | 4 GB | 8 GB+ |
Buy more RAM than you think you need — then use swap as your safety valve. RAM is cheap compared to the time you spend debugging OOM kills at midnight. A 4 GB VPS costs a few dollars more per month than a 2 GB one, and it saves you from the "just one more container" cliff that catches every self-hoster eventually.
If you are not sure where to start, read our guide on VPS sizing for self-hosting or check what to check before upgrading a VPS plan — sometimes the answer is optimize, not upgrade.