Guides / Low memory
Make the most of a 512 MB server
Last updated 3 November 2026 · By Mohammad AlSaraf
A fresh natbox server uses about 20 MB of memory, so almost all of your plan is free for your apps. Most memory problems come from app defaults written for big machines. A few settings fix them.
1. See what uses memory
free -m
ps -eo rss,comm --sort=-rss | head -15 # biggest processes, in KB
systemd-cgtop -m # memory per service
free shows your own server's memory, not the host's. Look at the available column: that is what your apps can still use. natbox servers have no swap, and you cannot add a swap file inside the server, so plan with real memory.
2. Turn off what you do not use
systemctl list-units --type=service --state=running
Stop and disable anything you do not need, for example a mail server or database left over from an old project: systemctl disable --now NAME. For the smallest base system, reinstall with Alpine.
3. Tune your apps
| Software | Setting | Why |
|---|---|---|
| Python web apps | gunicorn -w 2 or a single uvicorn process | Each worker is a full copy of your app |
| Node.js | node --max-old-space-size=256 app.js | Keeps the heap below your plan's memory |
| Java (Minecraft and others) | java -Xms128M -Xmx384M -jar ... | Java takes a share of all memory by default |
| MariaDB / MySQL | innodb_buffer_pool_size = 32M and performance_schema = OFF | The defaults alone can take 150 MB or more |
| PostgreSQL | shared_buffers = 32MB, max_connections = 20 | Each connection is its own process (PostgreSQL guide) |
| PHP-FPM | pm = ondemand, pm.max_children = 3 | Starts workers only when requests arrive |
| nginx | worker_processes 1; | One worker is plenty for a small site |
Need a database for a small app? SQLite needs no server process at all and handles more traffic than most small projects get.
4. Cap an app so it cannot take everything
If one app grows without limit, cap it in its systemd service, so it is the one that gets stopped, not your SSH session or database:
systemctl edit myapp
[Service]
MemoryMax=300M
Restart=always
With Restart=always, systemd starts the app again after it is stopped. See keep an app running with systemd.
5. Spot out-of-memory kills
When the server runs out of memory, the kernel stops a process to free some. It vanishes with no error from the app itself. systemd records it:
systemctl status myapp # look for "status=9/KILL" or "oom-kill"
journalctl -u myapp -n 50
If it happens often, lower the app's settings above, or give it more room.
What fits in 512 MB
- Several Discord or Telegram bots in Python or Node.js.
- A static site or a small PHP site with nginx and PHP-FPM.
- A personal WireGuard VPN, with AdGuard Home.
- A small API with SQLite or a tuned PostgreSQL.
- Uptime Kuma, Gitea or code-server are happier on 1 GB.
Outgrowing it? Upgrade to Box (1 GB) at $1.25 a month from the client area. Your server is resized in place, with the same data, addresses and ports. More ideas: What can you run on a small VPS?
More guides: Run a Minecraft server, Host multiple websites on one server, Run several apps behind an nginx reverse proxy.