[Hampshire] Swap versus RAM size (was: I just have to tell s…

Top Page

Reply to this message
Author: Keith Edmunds
Date:  
To: hampshire
Old-Topics: Re: [Hampshire] I just have to tell someone...
Subject: [Hampshire] Swap versus RAM size (was: I just have to tell someone...)
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

--
Keith Edmunds

+-------------------------------------------------------------------------+
|    Tiger Computing Ltd    |  Helping businesses make the most of Linux  |
|  "The Linux Specialists"  |       http://www.tiger-computing.co.uk      |

+-------------------------------------------------------------------------+