1GB VPS swap stopped the OOM killer only when RAM plus swap covered the demand. On 2026-11-24 (UTC), a 2,200 MiB allocator on Ubuntu 24.04.5 (kernel 6.8.0-149-generic) was killed in 11.5 to 11.9 s without swap and 37.7 to 47.2 s with a 1 GB file. With 2 GB it finished. Each result held in 3 of 3 runs.
The kernel chose the allocator (python3) as the victim in all nine kills on our Vultr test box. At a smaller 1,200 MiB target, 1 GB of swap was enough. The cost showed up in two places: in each 1 GB run that ended in a kill, one new SSH login stalled or failed after 9361 to 10120 ms, and the allocator that survived 2,200 MiB on 2 GB needed 25.585 to 33.971 s per pass to touch its memory again.

Does swap prevent the OOM killer? Results from 18 runs
Swap prevented the kill in 9 of our 18 runs: both targets with 2 GB, and the 1,200 MiB target with 1 GB. The other nine ended in a kernel kill: all six without swap, and all three with 1 GB at 2,200 MiB.
| Swap, target | Killed | Seconds to kill, per run | Victim | Peak swap-out so (KB/s) | Peak PSI full avg10 (%) | Worst new SSH login, per run |
|---|---|---|---|---|---|---|
| None, 1,200 MiB | 3 of 3 | 11.8, 11.7, 11.7 | python3 | 0 | 2.94 to 3.67 | 1490, 1260, 1411 ms |
| None, 2,200 MiB | 3 of 3 | 11.7, 11.9, 11.5 | python3 | 0 | 2.22 to 3.54 | 1402, 1442, 1194 ms |
| 1 GB, 1,200 MiB | 0 of 3 | no kill | none | 128,972 to 274,664 | 9.97 to 11.18 | 1495, 1994, 1660 ms |
| 1 GB, 2,200 MiB | 3 of 3 | 37.7, 47.2, 42.2 | python3 | 110,516 to 154,756 | 39.24 to 54.77 | 9361 ms, then 10120 and 10117 ms (both failed) |
| 2 GB, 1,200 MiB | 0 of 3 | no kill | none | 118,168 to 231,600 | 6.34 to 10.2 | 1097, 1925, 2521 ms |
| 2 GB, 2,200 MiB | 0 of 3 | no kill | none | 183,008 to 293,236 | 12.49 to 13.55 | 1765, 1711, 1614 ms |
The two no-swap rows are effectively one test. In all six of those runs the last logged total was 700 MiB and the process died during the next 50 MiB chunk, so neither target was reached.
Seconds to kill run from the allocator's first log line to the kernel's kill line, on the same server clock. The SSH column covers probes overlapping the window from allocator start to kill or finish. The so and PSI peaks use samples from allocator start until sampling stopped a few seconds after the kill or finish, because a kill's pressure can appear in PSI just after it. The 2 GB, 2,200 MiB runs opened with 11.00 to 14.01 of PSI left over from the kill before them; we excluded the 14.01, sampled before the allocator started.
Both samplers aimed for one reading per second but had gaps in the three 1 GB kills: up to 8.5, 11.9 and 13.9 s for PSI, and 6, 11 and 7 s for vmstat. The so and PSI peaks in that row may miss the worst moment.

How we ran the swap and no-swap tests
We ran a Python 3.12.3 allocator on Vultr's vc2-1c-1gb plan in Tokyo (1 vCPU, 955 MiB total in free -m, 25 GB SSD), three times per combination. Each run pushed memory up in 50 MiB steps until the target or the kill.
Every step filled 50×1024×1024 bytes from os.urandom, wrote a synced log line and slept 0.5 s. At its target, the allocator held for 15 s, then read one byte of every 4096-byte page in two full passes. Its log labels these sizes "MB", but they're MiB. The allocator ran as a separate systemd unit, and its kill lines show oom_score_adj:0. The swap part of the setup was:
swapoff -a && rm -f /swapfile # remove the stock file
fallocate -l 1G /sw1g && chmod 600 /sw1g && mkswap /sw1g
fallocate -l 2G /sw2g && chmod 600 /sw2g && mkswap /sw2g
# before each run (no swapon for the no-swap runs)
swapoff -a
swapon /sw2g # or /sw1g
sync; echo 3 > /proc/sys/vm/drop_caches; sleep 3
The "1 GB" and "2 GB" files are 1G and 2G in fallocate, so GiB. We left the kernel settings as the image had them: vm.swappiness=60, vm.overcommit_memory=0, vm.panic_on_oom=0, vm.oom_kill_allocating_task=0.
For responsiveness, an off-site client opened a new SSH connection to run true, with ConnectTimeout=10. It started one every second, or as soon as the previous one returned if that took longer. A connection took about 0.8 s with the server idle, so a 1 to 1.5 second result isn't a stall. These probes also use memory on the server.
Which killer fired: the kernel, not systemd-oomd
The kernel OOM killer made all nine kills. This image had no systemd-oomd: is-active returned inactive, is-enabled returned not-found, dpkg didn't list it, and its journal was empty in every run. This is the first 1 GB kill at 2,200 MiB:
Nov 24 23:23:54.959915 vultr kernel: Out of memory: Killed process 17615 (python3) total-vm:1861468kB, anon-rss:789376kB, file-rss:2560kB, shmem-rss:0kB, UID:0 pgtables:3596kB oom_score_adj:0
The line just before it carried global_oom, so this was a host-wide kill and not a container limit. To look for the same thing on your server:
journalctl -k | grep -iE "oom|killed process|out of memory"
systemctl is-active systemd-oomd
Launchpad bug 1972159 is about systemd-oomd, a separate user-space killer, so it isn't evidence for what the kernel killer does.
The process that triggered the killer varied: systemd in four runs, sshd in two, python3 in two and systemd-journal in one. That isn't the same as the victim. With vm.oom_kill_allocating_task at 0, the kernel documentation says the killer scans tasks and picks one by heuristics. Our allocator was always the largest process, so the runs don't show which of several real services would go first.
What 1 GB of swap bought before the kill
At 2,200 MiB, 1 GB of swap moved the median kill from 11.7 s to 42.2 s, which is 30.5 s more, and the process still died. Most of that gap comes from our allocator's pace: the last logged total rose from 700 to 1,750 MiB, or 21 extra steps. A faster leak would get less time, and a slower one more.
The end looked different too. Without swap, the kill came 1.07 to 1.30 s after the last log line. With 1 GB it came 6.09, 11.40 and 7.82 s after. The stalled logins started 28.3 to 28.9 s into the runs, before that last log line:
- In the first run, one login took 9361 ms and succeeded.
- In the second, a login failed at 10120 ms (ssh exit code 255, with a 10-second connect timeout), and the next one took 8913 ms.
- In the third, a login failed at 10117 ms and the next took 4941 ms.
Added up, 19.0 s and 15.1 s passed across those two pairs before a new login got through. Outside these three runs, no probe failed and the slowest took 2521 ms.
What you pay when the process survives
Surviving meant slow memory access. One pass over the allocated pages took this long:
| Swap, target | Seconds per pass, lowest to highest (2 passes × 3 runs) | Allocator finished, after start |
|---|---|---|
| 1 GB, 1,200 MiB | 13.922 to 14.991 | 62.8 to 64.7 s |
| 2 GB, 1,200 MiB | 11.094 to 12.344 | 57.7 to 58.8 s |
| 2 GB, 2,200 MiB | 25.585 to 33.971 | 105.5 to 117.1 s |
We have no pass time for a set that fits in RAM, so these aren't slowdown factors. Each finish time includes the paced ramp, the 15-second hold and both passes. A pass touches every page in order, and we didn't model a service that keeps a small hot set.

Our sizing call: available RAM plus swap is the ceiling
In our nine kills, the starting available figure from free -m plus total swap landed within 16 MiB of the last total the allocator logged. That makes it a usable first estimate of how far one growing process gets on this box.
| Runs that ended in a kill | available at start | Swap total | Sum | Last logged total |
|---|---|---|---|---|
| No swap (6 runs) | 703 to 716 MiB | 0 | 703 to 716 MiB | 700 MiB |
| 1 GB, 2,200 MiB (3 runs) | 711 to 714 MiB | 1,023 MiB | 1,734 to 1,737 MiB | 1,750 MiB |
The log only moves in 50 MiB steps, so read that match as "within one step". Plan RAM would mislead you: 955 MiB of RAM plus 1,023 MiB of swap is 1,978 MiB, and all three 1 GB runs died during the chunk after 1,750. The 2 GB runs fit the rule without testing its edge: 709 to 713 MiB available plus 2,047 MiB of swap leaves room for 2,200 MiB.
So the judgment is this. On this plan, swap pays off when your peak fits under available plus swap and you can live with slow passes. When the peak doesn't fit, 1 GB bought a median 30.5 s at our pace, plus a 9 to 10 second SSH stall, and the kill came anyway. If your normal working set stays above available RAM, buy the next RAM size before a larger swap file.
Common swap advice, checked against our numbers
Our runs support the first claim in part, support the second in part, and can't judge the third.
SSD Nodes (2026-11-23): swap makes the OOM killer a last resort, can turn a kill into a very slow server, and 2 GB suits a 1 GB box. Its article has no benchmark of its own. Supported for our load: kills were delayed or avoided, the 1 GB kills came with stalls, and 2 GB held both targets. We didn't test sizes above 2 GB, so this doesn't show 2 GB is the right size.
Akamai community thread: the OOM killer doesn't kick in while a server is only swap-thrashing. We saw only the search snippet, not the thread. Partly supported: the 2 GB runs swapped out at up to 293,236 KB/s without a kill. Once swap was nearly full, the kill did come. Peak swpd in the three 1 GB kills was 1,048,424 to 1,048,568 KB of a 1,048,576 KB file.
Launchpad 1972159, comment 16 (2022-06-17): programs killed on 1 GB servers with a 3 GB swap file far from full. Neither confirmed nor contradicted. The comment doesn't name the killer, we didn't test 3 GB, and our image had no systemd-oomd. In our own kills, swap was either off or had reached nearly its full size.
Check for existing swap before adding a 1GB VPS swap file
Run swapon --show first, because the stock Vultr Ubuntu 24.04 image already has swap. Ours listed /swapfile at 2.3G (2,399 total in free -m) with a line in /etc/fstab. We recorded the same 2,399 on 2026-09-26, during our Coolify test on a 1 GB plan.
swapon --show
free -m
If they show no swap, our free Linux swap calculator suggests a size. These commands, run as root, add a 2 GB file like the one we tested, plus a boot entry:
fallocate -l 2G /sw2g
chmod 600 /sw2g
mkswap /sw2g
swapon /sw2g
echo '/sw2g swap swap defaults 0 0' >> /etc/fstab
Don't run swapoff -a on a full box to exchange swap files. In that Coolify test, swapoff with 431 MiB swapped out was itself OOM-killed after 26 s. Swappiness isn't a shortcut either: the kernel page describes it as the relative IO cost of swapping against filesystem paging (0 to 200, default 60). It's a preference and doesn't add room.
Who shouldn't rely on swap here
Skip swap as your safety net if a restart is better for you than a stall of 10 to 20 seconds. That threshold comes from the 1 GB kills: single logins stalled 9361 to 10120 ms, and two runs went 15.1 and 19.0 s before a new login succeeded. We timed SSH logins, so apply it to HTTP health checks with care.
- Services with a 10-second timeout. A quick kill plus an automatic restart may be easier on clients than a box that hangs first.
- Processes that scan their whole memory. Our survivor needed 25.585 to 33.971 s per pass at 2,200 MiB.
- Runaway leaks. If growth never stops, swap moves the kill later. For containers, a cap keeps the kill inside one of them; see our Docker container memory limits guide.
What this test did not cover
- The stock 2,399 MiB swap setup. We recorded it, then deleted it for the test. No allocator run used it.
- Sessions already open. Every probe was a new SSH connection, so whether an open shell stays usable is unknown.
- Real services. One synthetic Python process, no database, web server or build, and no second service for the kernel to choose between.
- zram, other swappiness values, cgroup limits. Swappiness stayed at 60.
- Other disks and providers. One server, one region, one kernel, about 20 minutes in total, with swap files on the same virtual disk as the root filesystem.
- A reboot between runs. We reset swap and dropped caches, so some state may carry over.
What to do on a 1 GB plan
Keep the 1GB VPS swap your image ships with. If swapon --show prints nothing, add 2 GB: at 2,200 MiB it was the difference between 3 of 3 kills (no swap or 1 GB) and 0 of 3. Then add your available figure to the swap total and compare it with your real peak. For scale, our Vaultwarden test on the same plan peaked at 87.72 MiB. If your peak is above the ceiling, get more RAM or cap the process.