Technical

Swappiness 1 Small RAM VM Proxmox: Downsides and OOM Risk

Swappiness 1 Small RAM VM Proxmox: Downsides and OOM Risk

Swappiness 1 on a small RAM VM in Proxmox stops the constant small MiB swap writes, but it also makes the OOM killer jump in sooner when memory gets tight. If you’re seeing swap I/O on a 1-2GB VM, the fix is usually adding RAM or tuning the app, not just cranking swappiness down.

A vintage circuit board with protruding components and connectors on a white background.

What swappiness actually does

Swappiness is a kernel tunable from 0 to 100. Lower values tell the kernel to avoid swapping unless it absolutely has to. On a desktop with 32GB RAM, setting it to 10 is fine. On a VM with 1GB RAM, it’s a different story.

With swappiness=1, the kernel will hold onto page cache and anonymous memory until the last moment. That means less disk I/O from swapping, but when memory runs out, the OOM killer has to pick a process to kill. And on a small VM, that moment comes fast.

What I measured on PVE 9

I tested a Debian 12 VM with 1GB RAM on Proxmox VE 9. Running a typical LAMP stack with MySQL and Apache, default swappiness (60) caused constant swap writes of a few MiB every few seconds. The disk was busy, and the VM felt sluggish.

Setting vm.swappiness=1 in /etc/sysctl.conf stopped the swap writes almost entirely. But under load, the OOM killer started killing MySQL or Apache within minutes. The VM didn’t slow down gradually—it just died.

Close-up of a vintage IBM circuit board showcasing electronic components and retro technology.

The real tradeoff

Swappiness=1 is not a memory-saving trick. It’s a swap avoidance trick. If your VM has enough RAM for its workload, it’s fine. If it doesn’t, you’re just moving the pain from slow disk I/O to sudden process kills.

For a small RAM VM, I’d rather see swappiness at 10 or 20. That still reduces swap I/O but gives the kernel a bit of room to breathe. Or better, add more RAM. A 512MB bump is cheaper than debugging random OOM kills at 3am.

When swappiness=1 makes sense

If your VM is running a single-purpose app that never spikes memory, swappiness=1 is fine. A DNS server or a lightweight proxy won’t notice. But if you’re running a database or anything that can grow, leave it higher.

Check your current swappiness with cat /proc/sys/vm/swappiness. If it’s already low and you still see swap I/O, your VM is simply out of RAM. No sysctl will fix that.

Related

If you’re tuning a Proxmox VM, also check memory ballooning doesn’t reduce host RAM usage? Here’s why and the fix.

Leave a comment

Comments are reviewed before they appear. Your email is never published.