Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Sep 1997 16:33:13 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Khelbin Sunvold <khelbin@ntplx.net>
Cc:        FreeBSD Questions <questions@FreeBSD.org>
Subject:   Swap space (was: BSD newbie installer...almost ready)
Message-ID:  <19970910163313.09039@lemis.com>
In-Reply-To: <Pine.SUN.3.96.970910013411.12836C-100000@sea.ntplx.net>; from Khelbin Sunvold on Wed, Sep 10, 1997 at 02:11:15AM -0400
References:  <199709100224.MAA01108@smmcroute.smmc.qld.edu.au> <Pine.SUN.3.96.970910013411.12836C-100000@sea.ntplx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 10, 1997 at 02:11:15AM -0400, Khelbin Sunvold wrote:
>
>
> On Wed, 10 Sep 1997 bsd@smmcroute.smmc.qld.edu.au wrote:
>
>> pentium 120 with a unix partition of around 450 Mb
>> It has a 1.1 Gb IDE + CD 8*(mitsumi) IDE. 2 serial ports and a Kingston 16 bit (NDis2) net card.
>> 2 FDloppy drives and a SB16 creative compliant sound card.
>
> According to something somewhere on freebsd.org (excuse my incredible
> vagueness. heh) you normally would want a swap partition of between 2 and
> 4 times the amount of memory you have.  UNIX Unleashed (and other
> literature) often claim that the de facto swap partition should start at
> twice the amount of RAM and then you tweak from there.

I suppose that, as long as you tweak a lot, that might make sense.
But consider two extremes, taken right now from real life:

1.  I run X, StarOffice, Netscape and a whole lot of other
    memory-hungry applications on my old 486 with 16 MB.  Sure, it's
    slower than hell, especially when changing from one application,
    but it works.  Since there's not much memory, it uses a lot of
    swap.  Here's the view of swap space as it is at the moment:

    Device      1024-blocks     Used    Avail Capacity  Type
    /dev/sd0s1b      122880    65148    57668    53%    Interleaved

2.  I run much more stuff on my Pentium with 96 MB of memory.  I've
    got lots of swap space, but what I see is:

    Device      1024-blocks     Used    Avail Capacity  Type
    /dev/wd0s1b       51200    14416    36720    28%    Interleaved
    /dev/sd0b         66036    14332    51640    22%    Interleaved
    /dev/sd2b        204800    14384   190352     7%    Interleaved
    Total            321844    43132   278712    13%

It's not so important that the Pentium is using less swap: it's using
.67 of its memory in swap, whereas the 486 is using 4 times its
memory.  Look at it from a different point, and it makes more sense:
swap makes up for the lack of real memory, so the 486 is using a total
of 80 MB of memory, and the Pentium is using 140 MB.  In other words,
there is a tendency to be able to say "the more main memory you have,
the less swap you need".

If, however, you look at it from the point of view of acceptable
performance, you will hear things like "you need at least one-third of
your virtual memory in real memory".  That makes sense from a
performance point of view, assuming all processes are relatively
active.  And, of course, it's another way of saying "take twice as
much swap as real memory".

The real problem is that things can go seriously wrong if you have too
little swap.  That's the reason why I've just added another 200 MB of
swap, because I was tired of X running out of memory and crashing with
all 40-odd windows.  But it's difficult to summarize this with a rule
of thumb.  I've just looked in a couple of books and found that they
haven't any better idea than I do.

Greg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970910163313.09039>