[CentOS] Re: Apparently no swap configured

Stephen Harris lists at spuddy.org
Wed Oct 29 14:09:50 UTC 2008


On Wed, Oct 29, 2008 at 09:56:34AM -0400, James B. Byrne wrote:
> I believe that the current recommendation is 2 x physical memory up to 2
> GB and then 1 x physical memory thereafter.
> 
> See:
> http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html
> 
> " Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and
> then an additional 1x physical RAM for any amount above 2 GB, but never
> less than 32 MB.

That's a silly recommendation, and never been true for Linux.  RedHat
don't always know what they're talking about.

In older BSD systems (eg around SunOS 4 times or before) swap space was
utilised oddly; all memory was allocated from swap, so you needed _at
least_ <physmem> of swap just to use all your real memory!  So if you
added <physmem> of swap then your total virtual memory size was still
only <physmem>.  No help!  So the rule of thumb came along that said
"swap = 2*<physmem>" and that gave you a VM of 2*<physmem>.   Linux never
did this (and I don't think modern BSDs do, either) so adding <physmem>
of swap will automatically give you twice <physmem> of VM.

So the old BSD 'swap=2*<physmem>' rule of thumb is now a linux
'swap=<physmem>' guideline instead.

But it's still just a rule of thumb, or a guideline.  How much swap you need
depends on your circumstances and load.  If you have 4Gb of RAM and find
the system is using most of it for cache then you may not even need any
swap!

-- 

rgds
Stephen



More information about the CentOS mailing list