Subject: Re: Excessive swapping / Memory problems
To: Chuck Swiger <cswiger@mac.com>
From: matthew sporleder <msporleder@gmail.com>
List: netbsd-users
Date: 09/06/2006 16:48:40
On 9/6/06, Chuck Swiger <cswiger@mac.com> wrote:
> On Sep 6, 2006, at 12:40 PM, Vincent van Scherpenseel wrote:
> >> "top -o size" will show you which processes are requiring lots of
> >> memory; it's possible that one of them is leaking, or it may
> >> simply be that you are trying to run too much on a machine with
> >> limited RAM.  Increasing the amount of RAM in your machine is
> >> probably going to improve the performance of the system
> >> significantly...
> >
> > The strange thing is that it's a very low loaded machine, only
> > running an SMTP server for my daily mail (about 50 messages a day)
> > and a webserver for my personal website (http://
> > vincent.vanscherpenseel.nl). Most of the visitors are spambots
> > targeting the blog comment system (I really need to implement a
> > CAPTCHA check, I know).
> >
> > Here is the top output of top -o size:
> >
> >   PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU
> > COMMAND
> >  9747 www       -4    0    35M    4K semwait    0:32  0.00%  0.00%
> > httpd
> [ ... ]
>
> Ah, eight to ten 35MB apache children will consume most or all of
> your RAM and swap space.
>
> Apache normally uses a lot less; a stock Apache-1 without anything
> expensive will take 5-8MB, and even Apache-2 + mod_perl or PHP takes
> around 15 - 20MB; perhaps you can reduce the max # of children
> running or remove a module or two that is bumping your memory usage
> up so much...
>


Also- forking a lot of httpd's will use swap to store the pid info and
stuff.  Try upgrading to apache2 and using thread-based stuff so you
fork a lot less (or just setting lower max children and tuning down
the default times for keeping tcp connections around- time-wait, etc).
 It will save some swap.