Memory upgrade and swap partition size

Bill Sconce sconce at in-spec-inc.com
Tue Sep 26 15:06:01 EDT 2006


On Tue, 26 Sep 2006 12:08:13 -0400
Kjel Anderson <kjel.anderson at gmail.com> wrote:

> Hey list,
> 
> I am probably exposing my ignorance by asking this, but I have to remember: 
> there are no stupid questions, just stupid people. 
> 
> I just upgraded the RAM in my workstation from 1GB to 2GB. Will resizing the 
> swap partition to the general guideline of double installed memory make a 
> performance difference? 


Hey, Kjel -

I subscribe to all the good information you've gotten in the earlier replies.
(Which is basically that, suspend-to-disk etc. aside, the larger your RAM
the LESS the need for swap space.)

The "law of conservation of memory" is that when you add up all bytes which
must be addressed to accomodate whatever combination of (possibly bloated)
stuff you're running, you need to have that much memory available - in real
RAM plus swap.

It's the kernel's job to move stuff back and forth, making it look like you
have enough memory when really some of it's being "faked" by disk.  The
tradeoff is that the part of your memory living on disk is a lot slower than
the real part.  (Which may or may not matter very much, depending on whether
the kernel is forced to move it back and forth a lot or a little.  You could
use a large number of Firefox tabs, for instance, with gigantic images in
each one, yet you only need to display one of them at at time.  Swap is
likely to be good enough in this case.)

My offering to the discussion: the "general guideline", which I've heard
and seen just as you have, is misleading to the point of near nonsense. 
The SMALLER your real memory the greater the need for swap.

I recently resuscitated a Presario laptop, a decent machine except for having
a maximum electrical capacity for real RAM of 384MB.  I had followed the old 
"2X" rule, and I lived with the consequences for longer than I'd like to admit.
It would run OK for most things -- mostly Firefox browsing, in fact -- but
when I opened just one tab too many you couldn't BELIEVE the performance
impact.  The poor disk went into overdrive, activity light on nearly full
bright as the kernel desperately thrashed things back and forth, trying to
get an arrangement on disk which would free up just a few more bytes.

One morning after a sufficient number of cups of coffee it dawned on me what
was wrong:  that the "2X" rule was fatal for a 384MB machine and my greedy
use of Firefox tabs.  I took a deep breath, wiped the disk, created a 2GB
swap file and reinstalled.  It NEVER stalls now -- the first week or so I
had to keep pinching myself how well the poor thing worked with "enough"
memory at last.  And how dumb I'd been to ever credit "2X".  An old wives'
tale...

.02

-Bill



More information about the gnhlug-discuss mailing list