Re: [Hampshire] Swap versus RAM size

Top Page

Reply to this message
Author: John Cooper
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Swap versus RAM size
Keith Edmunds wrote:
> On Sat, 25 Oct 2008 21:40:15 +0000 (GMT), b.stevens611@??? said:
>
>
>> I've always used the same size swap space as memory... I remember
>> reading somewhere that that was the way to do it.)
>>
>
> It's about time this particular myth was buried (and the "swap should be 2
> x RAM" one). Suppose you had a system that had a performance issue, and
> you found that it was swapping a lot. For the sake of example, let's
> assume 1Gb RAM and 1Gb swap. When you look closer, you see the swap file
> is usually around 40%-60% used, peaking at 80%. That means the system is
> trying to use around 1.5Gb of RAM, so you fit an extra 1Gb to give 2Gb in
> total.
>
> What now would be the logic in increasing the swap file size? (I'm
> assuming a constant-ish load: if the load is increasing then you may well
> need more memory of one sort or another).
>
> Historically, it was recommended that the swap size should be 2 x RAM.
> However, that was in the days when (real) memory was very expensive, and
> it was relatively cheap to have a larger swap file. Perhaps that advice
> could have been better written, "The amount of RAM you need is at least
> 50% of the swap space you have". /That/ makes sense, because real memory
> is much faster; if you run short of memory again, increasing the RAM
> doesn't break that guideline, and increasing the swap suggests that,
> really, you need a increase in RAM too, which again seems logical.
>
> Maybe someone else has a different perspective on this?
>
> Keith
>
>

I've just installed a server with 12GB RAM. I checked with the Red Hat
guide and it suggested creating a swap size of 2x the RAM up to 2GB.
2GB+ should then have 1x swap size + 2GB e.g. 12GB RAM, 14GB swap. I've
also read about ensuring you have enough space for a kernel dump, though
as the dump is compressed, this reduces the swap space required, so the
2GB rule seems reasonable.

http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Deployment_Guide/s1-swap-what-is.html

--
--------------------------------------------------------------
Discover Linux - Open Source Solutions to Business and Schools
http://discoverlinux.co.uk
--------------------------------------------------------------