On a $4–$6/month VPS, RAM is the most expensive thing you rent. Upgrading from 1 GB to 2 GB typically adds 40–60% to the monthly bill, yet most small workloads never touch the second gigabyte. Swap space — disk that Linux uses as emergency memory — is the cheapest way to stretch a small plan, and on nearly every budget provider it costs nothing. This guide covers how much swap a budget VPS actually needs, when it helps, when it hurts, and how to configure it in under ten minutes.
The numbers matter more than the marketing. A default Ubuntu 24.04 install with Nginx, PHP-FPM, and MariaDB idles at roughly 400–550 MB of RAM, leaving 450–600 MB of headroom on a 1 GB plan. That is enough for a low-traffic WordPress site, a handful of cron jobs, or a small API. The moment you add a second site, a build process, or a traffic spike, memory pressure climbs — and that is exactly when 2 GB of swap absorbs the burst for $0 instead of a $3/month upgrade. When you compare budget VPS plans side by side, pay attention to storage type as well as RAM, because swap performance depends almost entirely on disk speed.
How Much Swap Do Different Workloads Actually Need?
There is no single “correct” swap size, but production data gives clear ranges. For a 1 GB RAM VPS running one WordPress site with page caching, 1–2 GB of swap is the sweet spot: enough to absorb PHP-FPM spikes without forcing the kernel to evict MariaDB’s buffer pool. For a 2 GB RAM plan running two or three sites, 2 GB of swap is plenty. For 4 GB plans, 2–4 GB covers almost any burst. Anything beyond 4 GB of swap on a budget VPS is usually wasted — if a workload routinely needs more than RAM plus 4 GB of swap, you should be buying RAM, not adding swap files.
| RAM | Workload | Recommended swap |
|---|---|---|
| 1 GB | 1 WordPress site + page caching | 2 GB |
| 1 GB | Node.js or Python API | 2 GB |
| 2 GB | 2–3 sites, small database | 2 GB |
| 4 GB | Multiple sites, build servers | 2–4 GB |
Swap File vs Swap Partition on Budget Hosts
Older tutorials tell you to carve out a swap partition, but on a modern budget VPS a swap file is simpler and just as fast. You can resize it without repartitioning, and on NVMe storage the performance difference is negligible. Most budget providers now ship Ubuntu or Debian images with a 1–2 GB swap file preconfigured — check with free -h before you add anything. If your image already includes swap, do not double it; that just wastes disk space for no benefit.
One caveat: swap only helps if your disk is fast. On a provider still selling spinning HDD storage, swapping stalls the kernel for hundreds of milliseconds per page-in — the server effectively freezes during memory pressure. If a host charges a couple of dollars more for NVMe, that upgrade pays for itself the first time your site hits a memory spike. Storage tier matters more for swap than for almost anything else you will do on the box.
Adding a 2 GB Swap File in Under Ten Minutes
If your image has no swap, create a file, format it, and enable it with these commands on Ubuntu or Debian:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Verify it is active with swapon --show. That is the entire setup. For most budget workloads, 2 GB of swap on a 1 GB RAM plan turns an out-of-memory crash into a brief slowdown — a reliability win that costs nothing extra.
When Swap Hurts: Swappiness and Swap Thrash
Swap is not free performance. If a workload needs more memory than RAM plus swap, the kernel starts thrashing — constantly writing and re-reading pages — and response times collapse. The fix is to tune how aggressively the kernel swaps. The default vm.swappiness of 60 is too eager on servers; most production setups use 10–20. On a budget VPS, set it to 10 so the kernel keeps hot pages in RAM and only touches swap under real pressure:
echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-swap.conf
sudo sysctl --system
Then monitor pressure before it becomes an outage. If free -h shows swap usage climbing past 80% for more than a few minutes during normal traffic, your workload has outgrown the plan — no amount of tuning fixes sustained memory demand. That is the signal to upgrade RAM, not to add another swap file.
The Bottom Line
Swap is the highest-leverage free optimization on a budget VPS. A 1 GB RAM plan with 2 GB of swap handles most single-site and small-API workloads, and a 2 GB plan with 2 GB of swap covers nearly everything short of sustained high traffic. Combined with fast storage and a swappiness value of 10, swap reliably keeps $4–$6/month servers alive through the spikes that would otherwise OOM them.
If you want a plan where the RAM and storage specs make swap tuning worth it, InterServer’s VPS plans include generous storage options at budget prices, and their price-lock guarantee means the rate you start with is the rate you renew at. For the full rundown of providers with fast NVMe tiers, see the full specs and pricing before you commit.

