> I had huge problems yesterday.  Our web site made it in to the Sunday
> Times and has had to serve 1/2 million request in the last 2 days.

Oh, I thought there was a /. effect, now it's a sunday effect :)

> Had I set it up to have proxy servers and a separate mod_perl server?
> No.  DOH!  So what happened to my 1Gig baby? It died. A sad and unhappy
> death.
> 
> I am in the process of fixing that, but if anybody could help with this
> question, it'd be appreciated.
> 
> I am running Apache 1.3.9, mod_perl 1.21, Linux 2.2.11, mysql
> 3.23.3-alpha.
> 
> What happened was this:  My memory usage went up and up until I got "Out
> of memory" messages MySQL bailed out.  Memory usage was high, and the
> server was swapping as well.  

First, what you had to do in first place, is to set MaxClients to
such a number, that when you take the worst case of the process growing to
X size in memory, your machine wouldn't swap. Which will probably return
an Error to some of the users, when processes would be able to queue all
the requests, but it would never keep your machine down!

Other than that you have to set a limit on the resources if you need , see
Apache::SizeLimit, Apache::GTopLimit, BSD::Resource

> So I thought - restart MySQL and restart Apache.  But I couldn't reclaim
> memory.  It was just unavailable.  How do you reclaim memory other than
> by stopping the processes or powering down?  Is this something that
> might have happened because it went past the Out of Memory stage?

Sure, when machine starts to make a heavy swapping you might wait for
hours before it gets stabilized. Since all it does it swapping in and
immediately swapping out. But when it's finished - you wouldn't see swap
zeroed - it would be still used when you check it with top (or other tool)
but it wouldn't be actually used if you have enough free real memory
(well not really - it would use it for a while). What I usually do is 

swapoff /dev/hdxxx 
swapon  /dev/hdxxx

on the swap partition if I know that there is enough
real memory available to absorb the data that will be deleted from swap.
it might take a while and make sure that you have ENOUGH memory to absorb,
it otherwise the machine will stack (I wouldn't it on a live server for
sure :)

Just remember that what you see in the stat, is not what really being
used, since linux and other OSes do lots of caching... 

Hope this helps...
_______________________________________________________________________
Stas Bekman  mailto:[EMAIL PROTECTED]    www.singlesheaven.com/stas  
Perl,CGI,Apache,Linux,Web,Java,PC at  www.singlesheaven.com/stas/TULARC
www.apache.org  & www.perl.com  == www.modperl.com  ||  perl.apache.org
single o-> + single o-+ = singlesheaven    http://www.singlesheaven.com

Reply via email to