Why we do not enable swap on VPSes

We are used to swap space on our desktops. But we do not offer it on VPSes.

Occasionally, someone asks whether they could have swap enabled in addition to their 4 GB of memory. We do not allocate any swap to users, because it makes no sense.

Even our physical servers do not use it, since they have 256 GB of RAM. If we enabled swap inside a VPS, its memory pages would simply be stored in the physical server's RAM again.

Also, the OpenVZ container virtualization we use artificially slows access to RAM marked as swap (swapcache), to emulate the behavior of real swap from the container's (VPS's) perspective.

In that situation, moving memory into artificially slowed memory makes no sense. It is more logical to give the VPS more RAM directly, which we can do in justified cases. But experience shows that only really poorly written applications require it. In the vast majority of cases, members manage with the allocated 4 GB of memory. Only a few ask for more.

ram

There is just one exception where we enable this emulated swap for a member. The Oracle database installer checks whether the server has swap. So we enable it during installation and can disable it afterwards. Oracle really does only check during installation; it does not care about swap at runtime.

Further reading: the VSwap article on the OpenVZ website.

Discussion

Discussions are not enabled yet. Open the forum