Neckrez

Swap size calculator and swap file setup

Enter your RAM and disk to see how much swap makes sense, the right swappiness for your workload, and the commands that create a swap file and keep it after a reboot.

Why a server wants some swap

Without swap, a memory spike makes the kernel kill a process, often your database. A little swap absorbs the spike and moves idle memory out of the way, so the RAM serves what is busy.

What swappiness means

The rule behind the number

Small machines get twice their RAM, up to 2 GB. Above that the size grows with the square root of the RAM: 2 GB for 4 GB, 3 GB for 8 GB, 4 GB for 16 GB. Servers do not hibernate, so there is no need to match the RAM.

More tools