Do I need SWAP on my server?

Solution 1:

If you have any spare disk space -- setup some swapspace there. You can always delete it if longterm stats show you that it's idle in your environment. But when something goes wrong (memory leaks, buggy software, etc.) you will appreciate having high load and be able do debug instead of getting "out of memory" errors and having to reboot.

Solution 2:

Last I checked, the general consensus was it was good to have swap to deal with unexpected temporary out of memory conditions. Back in the day we used to provision server swap with 1.5X physical memory, but that was when systems had a lot less memory than they do today.

With a host with that much RAM, I suggest either keeping a small swap space, or set it up with no swap at all, and do some load testing to determine how the machine performs in low memory conditions. If that testing is ok, then don't even set up any swap at all.

Remember you can always set up a swapfile later if you need one.

Solution 3:

Yes, you need swap space. Speaking generally, some programs (such as Oracle) will not install without swap space present in sufficient quantities. Some operating systems (such as HP-UX - in the past, at least) preallocate swap space based on what is running on your system at the time.

Of course, this is not true (to my knowledge) for Linux itself.

Swap is often used as dump space - so you might want enough to capture a full kernel dump to disk. However, if you don't expect to be doing kernel traces (either yourself or through a support contract) then you could skip having that much space.