Memory thrash and capacity on a 1 GB VPS
oomswapdnfphp-fpmcapacitylinodealma-linuxtriage
The production server is a 1 GB Linode Nanode (1 vCPU, 957 MB RAM, 512 MB swap, 25 GB disk) running MariaDB, Apache, php-fpm and nginx for several sites. On a box this small, the usual failure is not a crash but swap thrash: one large process pushes everything into swap and the machine stops answering for minutes. Two root causes were found and fixed; the diagnosis path is reusable.
Recognizing thrash from outside
- Smoke test or curl returns status
000on every check. - Ping may fail, but TCP ports still accept connections and nothing ever sends a byte.
- SSH hangs at "banner exchange". The kernel is alive (it completes the handshake), userspace is starved.
- That combination means memory starvation, not a network problem.
Evidence after the fact: journald on this box is not persistent, so journalctl -b -1 shows
nothing from before a reboot. Look in root-only /var/log/messages for Out of memory: Killed
process. During episodes every service (nginx, mariadbd, systemd, rsyslog, fail2ban) shows up as
an oom-killer invoker because they are all starving; the victim identifies the culprit.
Culprit 1: dnf-makecache.timer
dnf-makecache.service refreshes package metadata on a systemd timer and balloons to roughly
730 to 770 MB RSS. On a 1 GB box that is a guaranteed thrash, then an OOM kill of dnf, then
recovery. In July 2026 it happened about every 100 minutes for a day until the box was rebooted.
Fix, standard on small VMs:
sudo systemctl disable --now dnf-makecache.timer
Metadata now refreshes only during manual dnf runs, which spike just as much; if one struggles,
stop MariaDB for the duration or add temporary swap. Watch for any new periodic job with a big
RSS: 1 GB leaves about 400 MB of headroom.
Culprit 2: php-fpm max_children sized for a bigger machine
The stock pool had pm.max_children = 50. At roughly 35 MB RSS per worker that is 1.75 GB, almost
twice the RAM, and 244 MB was already in swap at idle. Resized in /etc/php-fpm.d/www.conf:
pm.max_children = 15
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 6
pm.max_requests = 500
Load test after (on-box ab, concurrency 40): zero failures, same throughput, less swap. Rule of
thumb: max_children <= (RAM you can give PHP) / (per-worker RSS).
A consequence for design: with 15 workers total, long-polling and PHP WebSockets are off the table; one slow request pins a worker. Prefer short polling or push. See Pull-based job queues for agents behind NAT (design).
Measured capacity (October 2026)
- API
GET /23 ms solo, about 157 req/s at concurrency 20 to 40; static web about 423 req/s. Real endpoints estimated at 30 to 60 req/s. Far beyond actual traffic. - Database 9.4 MB. User uploads live in object storage, not on the disk.
- Disk: unpruned release artifacts were the biggest consumer (5.6 GB of old APKs); pruning took the disk from 63% to 41% used. See Release-directory deploys with an atomic symlink swap.
Options if it recurs
earlyoom, persistent journald (Storage=persistent), or the 2 GB plan. The box is too small for
media transcoding or hosting.