Skip to main content

Swap | Is it really needed?

Comments

4 comments

  • movielad
    ]From what i know it is more a failsafe to keep your server from crashing if it runs out of ram. But I need to be sure so i am asking here. My current dedicated server running WHM/Cpanel has more ram than I'll probably ever use and runs on SSD drives so disk space is it a premium. So if I have more ram than what will ever be used do I really need to add a swap file?

    It's not necessary, but it is recommended. My own company does not provide swap files/partitions with our virtual private servers as we discovered far too many people taking out low spec servers with cPanel/WHM and the combined system I/O across those servers swapping memory in and out resulted in substantial performance degradation. You'll find a lot of VPS web hosts do not provide swap by default. Some will allow you to use a swap file, but not all. Martyn
    0
  • Dradden45
    Great information movielad. Thank You.
    0
  • cPanelMichael
    Hello :) I've moved this thread to our "Optimization" forum. Thank you.
    0
  • hydn79
    It's important. You can avoid the kernel's OOM killer from shutting down services like MySQL abruptly. If hosts allows you can manually add swap using the following commands as root:
    fallocate -l xG /swapfile chmod 600 /swapfile mkswap /swapfile swapon /swapfile
    xG = in gigabytes. Eg. 8G for 8gb swap. Auto swapon during boot. Edit /etc/fstab and add at the end:
    /swapfile none swap sw 0 0
    0

Please sign in to leave a comment.