Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Swap | Is it really needed?

Discussion in 'Workarounds and Optimization' started by Dradden45, Feb 1, 2015.

  1. Dradden45

    Dradden45 Active Member

    Joined:
    Sep 7, 2012
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    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?
     
  2. movielad

    movielad Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    109
    Likes Received:
    2
    Trophy Points:
    168
    cPanel Access Level:
    Root Administrator
    Twitter:
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Dradden45

    Dradden45 Active Member

    Joined:
    Sep 7, 2012
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    Great information movielad.

    Thank You.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,409
    Likes Received:
    1,954
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    I've moved this thread to our "Optimization" forum.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. hydn79

    hydn79 Active Member

    Joined:
    Feb 1, 2013
    Messages:
    25
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    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:
    Code:
    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:
    Code:
    /swapfile   none    swap    sw    0   0
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice