To swap or not to swap that is the question
Kent Borg
kentborg at borg.org
Mon Oct 7 18:33:39 EDT 2002
On Mon, Oct 07, 2002 at 04:06:25PM -0400, ron.peterson at yellowbank.com wrote:
> On Mon, Oct 07, 2002 at 03:05:01PM -0400, Jerry Feldman wrote:
>
> > The old rule of thumb was 3 X memory.
>
> Or 2x, or 2.5x...
>
> I believe early 2.4 kernels required an amount of swap equal to ram
> *before* you began to increase the size of your VM.
As long as we are in 2-cents mode...
I say set your swap to 256 MB. On a really little machine maybe set
swap to two to four times RAM, but there is no point in having more.
No harm either, but no benefit.
My reasoning is based on observation. On kind of little (64MB) to
reasonable machines (512MB) I have seen swap usage go well over a
hundred MB and have things be running nicely but have never seen it go
to 200 MB with out things first becoming unhappy. On a large machine
(1 GB or more) it seems the whole reason for all that memory is to
keep things in RAM and that the kernel might find things that aren't
being used and swap them out in favor of valuable things like disk
cache, but that 256 MB is still a lot of unused stuff to find. Should
a big machine have no swap? No, the kernel might find something that
isn't being used and turn its RAM into cache. Swap is good.
I guess it boils down to this: bandwidth to disk is a bottleneck,
until disks (and controllers and bus bandwidth) are only so fast and
until they get faster, 256 MB is a lot of swap. More won't hurt, and
with modern big disks is no burden so why not, but I see no benefit.
I can imagine that a fast, 4-CPU machine, with wicked fast disks might
have use for going a higher, but not as high as, say, 1 GB. Anyone
have a concrete scenario where more swap is useful?
-kb, the Kent who expects he will be shrinking his notebook's swap
size from 512 MB down to 256 MB next he upgrades the OS because he
could use a tab more space here.
Another note: the Linux kernel 2.4 rule of thumb to have twice as much
swap as RAM seems to only have been true for an early version of the
2.4 virtual memory system that no one actually uses.
-kb
More information about the Discuss
mailing list