Do we still need swap partitions on servers?

There is a common misconception that having a swap space is negatively affecting system performance. This is incorrect. As long as you have enough RAM, having a swap area whatever its size doesn't hurt performance at all. What affects performance is being short in RAM and effectively using the swap space.

  1. If you have no swap space and happen to be out of RAM, the kernel will pick one or more processes which it thinks are good candidates (although you might give it some hints though) and kill them.

  2. If you have a swap space and are out of RAM, the kernel will pick less used memory pages and put them on the swap area to free RAM. This will slow down the system but your applications won't be affected otherwise.

I always prefer case 2. as I feel uncomfortable loosing parts or all of my work because the kernel thinks my applications are worth killing. Moreover, with the current size of an average disk being in the TB range, reserving a few percent for swap is usually not an issue.


If you have a RAM of 3GB or higher, Ubuntu will automatically NOT USE the Swap space since it's more than enough for the OS.

Now do you really need a swap partition?

The answer in my opinion is yes. Because you don't know what will you be installing or doing in the future that might require the need of swap space. Also if you're planning to use hibernation, you might want to have some swap space. You actually don't have to have swap partition, but it is recommended in case you do use up that much memory in normal operation.

For more information on the need or not fro swap, see Ubuntu Swap Faq, or Swap Requirements


For the last 6 years or so I have used desktop systems with at least 8GB RAM. I don't remember a case when the system swapped out memory under normal usage - and I monitor resource usage quite often with htop. Not even in cases when I ran 4 virtual machines (servers) simultaneously for development purposes did swapping occur.

Having said that, if the applications you are running are memory intensive (eg video editing, image editing, large database table manipulation, etc) you may face a situation where your system might run out of memory. In that case it may be desirable to have a swap space. Think of it as a last resort safety net. And considering the multi-terrabyte capacity of today's systems, what's a couple of gigabytes in a swap partition worth? Better be safe than sorry :-)