[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apache Out of Memory



On Fri, Oct 05, 2001 at 04:15:24PM -0400, Thomas R. Shemanske wrote:
> The largest demand on the server comes from a web-based homework system 
> which uses a cgi interface.  We have 600 students using the system
> (dual 550MHz Pentium III with 256M RAM)
> 
> Two days ago, I received a message from the Apache Error Logs that said:
> [Wed Oct  3 20:10:55 2001] [error] server reached MaxClients setting, 
> consider raising the MaxClients setting
> 
> so I raised the limits from 250 to 512 (the compiled max).
> 

Note that the max number or procs in the default i386 kernel is 512, so
you may reach that limit before the Apache MaxClients limit.

> QUESTION 1:  How can one determine the number of active clients at a 
> given time?  I would like to monitor this.

you could try a number of ways:

'ps aux | grep -c apache' will let you know approximately how many 
servers are running.

netstat -vatn | grep 'my.ip.addr.ess:80' | grep -c ESTABLISHED

will let you know how many connections are established to port 80 on
your box.

> 
> The next night with the increased MaxClients setting, the CPU load 
> suddenly shot to 50, effectively closing off most services.  The load 
> went from 1 to 50 and back down in the space of approximately 30 
> minutes, and while the load was very high, the Apache error logs kept 
> posting "Out of Memory Messages"

swapping?  dunno.  In any case, I would reduce MaxClients so that you
don;t get this problem again.  It's better to lock a few users out than
to make the system unusable for everyone.

> 
> My guess is that this was a real memory allocation problem (i.e. kernel 
> based).  I have only seen such loads about a year ago when we had random
> VM problems, but since I compiled a 2.2.19 kernel, virtual memory has 
> been rock solid.
> 
> QUESTION 2:  Could the cgi scripts be responsible for this? I am 
> guessing this is the case, but I have no idea how to gather evidence.
> They are in use at many institutions, so things are not so clear.  Any 
> ideas on how to track the source of this problem down would be appreciated.
>

Just looking at your setup I would say to add memory.  (fast and cheap,
but perhaps not diligent).

It's hard to know anything else without knowing what the cgi does.  If
they are in use in many institutions I would recommend contacting some
other users and seeing if they have experienced the same problem.

g

Attachment: pgpQVxRFmP_ZK.pgp
Description: PGP signature


Reply to: