Fill the Server: 80% off your first 4 monthly invoices, monthly billing. Ends Nov 30, 2026. 25 spots in this batch.FILL25
Fill the Server, annual: about 29.63% off your first annual invoice. Ends Nov 30, 2026.FILL25Y
Fill the Server, 2 year term: about 15.69% off your first biennial invoice. Ends Nov 30, 2026.FILL25B
Fill the Server, 3 year term: about 11.11% off your first triennial invoice. Ends Nov 30, 2026.FILL25T
80% off your first 3 months, monthly billing. Ends Dec 25, 2027.3MONTHS80
50% off your first annual Shared term. Ends Dec 31, 2027.50SHARED
Shared Starter, 3 year term: C$105.84 total.MOOSE294
20% off your first 3 monthly VPS invoices. Ends Dec 31, 2027.20VPS3
25% off your first annual base VPS term.25VPS

← All guides

VPS & Linux

Linux swap sizing: how much swap a VPS actually needs

Published August 2026 · 2 min read · Updated 2026-09-05

Swap sizing is a workload decision, not a universal ratio of RAM. Swap can provide a safety margin and move cold pages out of memory, but it cannot make a memory-starved application behave like a machine with enough physical RAM.

Decide what swap is supposed to do

For a server, swap may absorb brief allocation spikes, keep infrequently used pages out of active RAM, or provide diagnostic time before memory exhaustion. Hibernation rules from laptops are usually irrelevant to a VPS.

A database or latency-sensitive workload may prefer conservative swapping, while a small general-purpose server may benefit from a modest safety margin.

Measure the working set first

Track MemAvailable, process RSS, cache behavior, concurrency, and peak tasks. Size the machine for its healthy working set. Swap should not hide permanent overcommitment.

If swap-in and swap-out remain active under ordinary load and response time worsens, the problem is capacity or tuning, not simply the swap-file size.

Keep storage and failure behavior in mind

Swap consumes disk space and I/O. On a nearly full root filesystem, a large swap file can create a different operational risk. Encrypted or sensitive workloads should also consider what can be written to swap and how the environment protects it.

Configure swappiness or application memory only after understanding the actual pressure pattern.

Validate after changing it

Create or resize swap with a rollback plan, then observe memory pressure, swap activity, I/O latency, and application behavior through a representative workload. Treat repeated swap thrashing as a trigger to tune or resize the VPS.

  • Define the purpose of swap.
  • Protect root-filesystem headroom.
  • Watch active swap traffic.
  • Use RAM sizing for sustained working sets.

Next step

Choose Linux swap based on workload, RAM pressure, hibernation needs and failure behaviour, then monitor whether swap is helping or hiding a memory problem.

Explore DotMoose VPS hosting

Keep reading

Related guides.

HTTP 500, 502 and 503 errors explained for website owners

Learn what HTTP 500, 502 and 503 errors usually indicate, which layer to investigate, what evidence to collect, and when restarting a service is not the real fix.

Read the guide

Linux file permissions: ownership, modes, groups and ACLs explained

Understand Unix ownership and rwx modes, then use groups and ACLs where needed so services can access files without opening them to every user.

Read the guide

Moving a DreamHost VPS to Canadian hosting

Inventory the server, copy it safely, test it, and cut DNS over with a rollback plan.

Read the guide

More vps & linux guides

We will handle the move. You check it first.

Your current site stays online until your new one is ready. You approve the copy first, and if anything is not right we switch you back right away. The price you pick is the price you renew at.

Start my free moveSee plans and prices
See pricesFree move