Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Mar 1999 21:12:02 +1000
From:      Greg Black <gjb@comkey.com.au>
To:        "Scott I. Remick" <scott@computeralt.com>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Out of Swap Space hangs system 
Message-ID:  <19990325111202.23942.qmail@alpha.comkey.com.au>
In-Reply-To: <4.2.0.32.19990323175122.0370cf00@mail.computeralt.com>  of Tue, 23 Mar 1999 17:55:12 EST
References:  <Pine.BSF.4.05.9903232021440.76938-100000@gwdu60.gwdg.de> <Pine.BSF.4.05.9903232021440.76938-100000@gwdu60.gwdg.de> <4.2.0.32.19990323175122.0370cf00@mail.computeralt.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> >It's not a serious problem -- a properly setup Unix
> >system will never crash from lack of swap.
> 
> Well, ok... so what are the proper setup steps to ensure a system will not 
> crash when the swap fills?  My system in question has a 50MB swap partition 
> and 16MB of physical RAM.  I've tried to take further steps to prevent my 
> swap from filling in the first place, but should it still happen sometime, 
> I want to be prepared.

It's impossible to advise you on the basis of the information
you have provided.  How many users are there?  Do they use X?
Do they run compilers?  Do they waste resources with C++?  How
many do these things at any one time?  Are there other resource
hogs that I haven't mentioned?  Generally, the less real memory
you have, the more swap you need if there is any actual work
being done.  On the other hand, if there's any real work to be
done on such a machine, people will find another machine if it's
that dependent on swap.  The best indicator of correct setup is
when the swap is rarely ever touched.  Most of my current BSD
boxes have 256 MB of swap whether they need it or not.  Here are
the results of pstat -s on five of them:

Device      1K-blocks     Used    Avail Capacity  Type
/dev/sd0s1b    262144   142332   119748    54%    Interleaved
/dev/sd0s1b    262144        0   262080     0%    Interleaved
/dev/sd0s1b    262144     2812   259268     1%    Interleaved
/dev/sd0s1b    262144     2604   259476     1%    Interleaved
/dev/sd0s1b    262144        0   262080     0%    Interleaved

The top one was being used for some weird stuff shortly after it
was brought up and in fact has not touched its swap since the
first day it was up (but you can't tell that from this display).

This is not much of answer, but it's not a question that lends
itself to simplistic answers -- you have to assess your
situation and then take a guess.  If it's important to you that
the machines don't fall over while you're getting a feel for
things, work out carefully how much swap you need and then
triple it.  See how you go.  If that's enough and you can live
with it, leave it set that way.

I never change the swap once I've set it up.  One of my BSD
boxes was setup about ten years ago.  Each time I added a disk,
I added more swap.  But it still has less than I'd give a
machine that had interactive users now.  But it has no
interactive users and no X and no compilers (it's quicker to
compile on something else and copy the executables across, as
this box in its latest incarnation is a 33 Mhz 486):

Device name  1K-blocks  Type
wd0b             31740  Interleaved
wd1b             48852  Interleaved
sd0b               441  Sequential
9328 (1K-blocks) allocated out of 81033 (1K-blocks) total, 12% in use

It's a different BSD too, but you can interpret the output
easily enough.  There's actually another disk in there, but it
went flaky about 18 months ago and so it's currently disabled.
When I pull the dead tape drive, I might do something about that
disk.  The silly swap space on the SCSI disk has a historical
reason, but it's not worth telling that story here.

-- 
Greg Black <gjb@acm.org>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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