Enterprise Architecture & Integration, SOA, ESB, Web Services & Cloud Integration

Enterprise Architecture & Integration, SOA, ESB, Web Services & Cloud Integration

Monday 10 June 2013

Linux - How much swap memory should I need?

Always, you will encounter a typical question - how much memory should be allocated to swap memory? Should it be same as the size of RAM, twice the size of RAM or else? This blog is not a tutorial on swap memory but a tip on its size.

Earlier recommendations (in the era of smaller size RAM) maintained that one should use swap memory which is twice the size of the RAM. It does not hold good anymore. You needed more swap memory because the size of RAM was small. But, now-a-days, you don't need to rely on swap memory for your (large) memory requirement when adequate RAM is cheaply available. If you have a large RAM that is sufficient to support your applications, then dependency on the swap memory reduces a lot (if not eliminated completely).

See blow recommendation from RedHat.

Amount of RAM in the system Recommended swap space Recommended swap space if allowing for hibernation
⩽ 2GB 2 times the amount of RAM 3 times the amount of RAM
> 2GB – 8GB Equal to the amount of RAM 2 times the amount of RAM
> 8GB – 64GB 0.5 times the amount of RAM 1.5 times the amount of RAM
> 64GB 4GB of swap space No extra space needed

Read the following articles for more information.
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s2-diskpartrecommend-ppc.html#id4394007

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-swapspace.html