From owner-freebsd-questions Thu Mar 25 3:17:42 1999 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (Postfix) with SMTP id BCCF714BE9 for ; Thu, 25 Mar 1999 03:17:36 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 23943 invoked by uid 1001); 25 Mar 1999 11:12:02 -0000 Message-ID: <19990325111202.23942.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Thu, 25 Mar 1999 21:12:02 +1000 From: Greg Black To: "Scott I. Remick" Cc: FreeBSD Questions Subject: Re: Out of Swap Space hangs system References: <4.2.0.32.19990323175122.0370cf00@mail.computeralt.com> In-reply-to: <4.2.0.32.19990323175122.0370cf00@mail.computeralt.com> of Tue, 23 Mar 1999 17:55:12 EST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > >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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message