Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 May 1999 23:16:57 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Jerry Preeper <preeper@cts.com>
Cc:        Doug White <dwhite@resnet.uoregon.edu>, freebsd-questions@FreeBSD.ORG
Subject:   Re: swap_pager: out of swap space (-->crash)
Message-ID:  <19990528231657.A3852@dan.emsphone.com>
In-Reply-To: <3.0.5.32.19990528174400.043c1750@crash.cts.com>; from "Jerry Preeper" on Fri May 28 17:44:00 GMT 1999
References:  <3.0.5.32.19990528154716.041b4280@crash.cts.com> <Pine.BSF.4.03.9905281630160.11808-100000@resnet.uoregon.ed u> <3.0.5.32.19990528174400.043c1750@crash.cts.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




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