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!

Do I really need a swap partition?

Discussion in 'General Discussion' started by Nirjonadda, Aug 29, 2017.

  1. Nirjonadda

    Nirjonadda Well-Known Member

    Joined:
    May 8, 2013
    Messages:
    597
    Likes Received:
    15
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    I have 50 GB RAM Do I need swap Memory? I read many places that the rule of thumb for swap space is to double the amount of physical RAM. I am using KVM, 10 CPUs and 50 GB RAM with SSD. Do I need still swap Memory at all with this high amount of physical RAM? Do you swap recommendation for performance ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,367
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Nirjonadda

    Nirjonadda Well-Known Member

    Joined:
    May 8, 2013
    Messages:
    597
    Likes Received:
    15
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,367
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    That type of question is better asked on a website such as StackOverflow where discussions of system performance tuning occur. You can also find a list of system administration services should you decide to consult with a qualified system administrator at:

    System Administration Services | cPanel Forums

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

    Nirjonadda Well-Known Member

    Joined:
    May 8, 2013
    Messages:
    597
    Likes Received:
    15
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Then how to create swap Memory in CENTOS 7 (KVM virtualization) ? I need At least 4 GB Swap Space from 50GB of RAM.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,720
    Likes Received:
    98
    Trophy Points:
    328
    cPanel Access Level:
    Root Administrator
    I read an article once (but I can't find it now, not sure where I read it at) that argued against using swap space, especially when you have gobs of RAM.

    The logic seemed pretty sound to me. Basically if you run out of memory and the kernel starts using swap space, this is just going to generate a lot of disk thrashing. But if you have no swap space and you start running out of memory, the kernel will start killing processes. Disk thrashing is typically what leads to unresponsive servers, because all of the kernel time is spent with disk i/o.

    I'm not really going to argue one way or another, but I think there is some truth to this line of thinking.
     
  7. Michael-Inet

    Michael-Inet Well-Known Member

    Joined:
    Feb 20, 2014
    Messages:
    48
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    Austin, TX, USA
    cPanel Access Level:
    Root Administrator
    At least one reason to have swap on a CentOS system is that without some amount of swap MySQL will crash tables constantly.

    This is from personal experience, we had a fairly similar setup, high RAM and figured we could turn off swap for a performance increase.

    We created 4GB of swap, MySQL became happy.

    ymmv,
    Michael
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. Greg M

    Greg M Active Member

    Joined:
    May 26, 2016
    Messages:
    27
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Glasgow, Scotland
    cPanel Access Level:
    Root Administrator
    I would recommend always having SWAP enabled even as a precaution, MySQL can be troublesome without it as Michael-Inet mentioned and should you ever run out of RAM having SWAP may just save you some trouble or give you some time before the system fails on you especially with an SSD drive your swap partition will respond very fast compared to standard disk and again especially if you have like cloud-based SSDs or something.

    Also, Linux usually has a default swappiness of 60 which means it will generally start using swap once your ram is 40% used. Set yourself at least 2 or 4GB of SWAP and set your swappiness to something like 30 or if you want to be extreme 5. With this, you are telling your OS / Kernel to only use the SWAP when you have ran out of RAM.



    Hope this helps a little

    Regards
    Greg
     
  9. Nirjonadda

    Nirjonadda Well-Known Member

    Joined:
    May 8, 2013
    Messages:
    597
    Likes Received:
    15
    Trophy Points:
    68
    cPanel Access Level:
    Root Administrator
    Then how to create swap Memory in CENTOS 7 (KVM virtualization) ?
     
    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