From owner-freebsd-questions Fri May 28 21:17: 9 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id EFA07151B5 for ; Fri, 28 May 1999 21:17:03 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id XAA04085; Fri, 28 May 1999 23:16:57 -0500 (CDT) (envelope-from dan) Date: Fri, 28 May 1999 23:16:57 -0500 From: Dan Nelson To: Jerry Preeper Cc: Doug White , freebsd-questions@FreeBSD.ORG Subject: Re: swap_pager: out of swap space (-->crash) Message-ID: <19990528231657.A3852@dan.emsphone.com> References: <3.0.5.32.19990528154716.041b4280@crash.cts.com> <3.0.5.32.19990528174400.043c1750@crash.cts.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.5i In-Reply-To: <3.0.5.32.19990528174400.043c1750@crash.cts.com>; from "Jerry Preeper" on Fri May 28 17:44:00 GMT 1999 X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (May 28), Jerry Preeper said: > This is post-crash with almost 2 hours uptime now. > > su-2.01# swapinfo > Device 1K-blocks Used Avail Capacity Type > /dev/sd0s2b 144585 7536 136985 5% Interleaved > > I just noticed in the faq129 that swap should be 2x memory as a rule > of thumb, so I guess I should bump this to 256MB swap from the 141 > MB. However, I hardly ever notice swap space getting used (I have the > top output on the server emailed me every two hours) and it rarely > has any swap space used with load averages of .1 to .25 and swap of > 10MB to 20MB used. This 2x rule is most important if you have <64MB of RAM, or expect to swap, ever. If you get low on memory, FreeBSD will swap idle processes out and not swap them back in unless they are needed (i.e. things like lpd, moused, getty's for any vtys you never use). I have also seen where a program will get swapped to disk, and when it gets swapped back into RAM, the swap space is not cleared. This makes sense if the system is low on space; if the kernel decides it needs to swap that process back out, any pages that weren't modified in RAM don't even have to be rewritten. From observing my 2.2-stable and 4.0 systems, swap space is only cleared when a process exits. > Should I be adding more RAM to the box as well? Like another 128MB or > something? If you never swap, it's not a problem. If you swap at all, follow the 2x rule. > On the getad.cgi, I have been running that program with no changes to > it for about a year now. The only recent changes to the machine was > the upgrade to 2.2.8-Stable about 2weeks ago. The program is a c > program for displaying ad banners that probably displays about 20,000 > banners per day. getad.cgi might not be the culprit, but it _was_ the largest active process at the time; see /sys/vm/vm_pageout.c, near the bottom of vm_pageout_scan(). Make sure there aren't any bugs in the cgi that might be triggered by garbled URLs or bad input. You can also set memory limits on the cgi with the setrlimit() function (or the ulimit shell command). Try setting the data size limit to 8MB and see if any cgis die. -Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message