gabriel rosenkoetter on Wed, 2 Jan 2002 23:20:23 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Swap Size


On Wed, Jan 02, 2002 at 04:43:16PM -0500, Bob Razler wrote:
> 	What is the consensus on the size of the swap partition?  RAM? 
> 2xRAM?
> 
> 	I have 256 Megs of RAM.

Conventional wisdom, even on the large Sun machines I've used and
administered, is still to keep two times main memory of disk space
around for swap, no matter how ridiculously huge that ends up being.

I'm no longer sure I agree with that. Whether or not 256 MB is a
lot depends on what exactly you're doing with the machine... If this
is a workstation, it's plenty; if you're serving an Oracle DB off
it, you're out of your mind.

Whenever you get to enough memory to be called "a lot" for your
application, you're probably safe dropping to swap merely the size
of your main memory. I am still wary of going lower than that, but
I'm a little paranoid. I can't think of a circumstance in which
having less swap than real memory would actually bite you, but I
haven't thought about it very hard.

That said:

% grep 'memory =' /var/run/dmesg.boot
total memory = 383 MB
avail memory = 351 MB
% swapctl -lk
Device      1K-blocks     Used    Avail Capacity  Priority
/dev/sd0b      524880    34456   490424     7%    0

So I'm a little under two times main memory right now, largely because
that machine only had 256 MB when I first put it together. I'll only
bother configuring another swap partition if I get past 512 MB of
memory.

And all this when the existing 512 MB of swap on my SCSI disk are
only 7% used. Probably a bit more when I've got both Opera and
Netscape running (which I frequently do, under Linux emulation). But
7% when that machine is handling DNS and mail service for
eclipsed.net (granted, not a huge domain) and firewalling my
apartment.

I guess the lesson here is that, unless you frequently run software
that goes out of control in the memory department, you'd probably
rather never see your shell tell you you're out of memory, which
means that having at least as much swap as memory is probably still
a rule of thumb, even if it's no longer absolutely necessary.

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpS1sifPcgHY.pgp
Description: PGP signature