Stas,

I use Apache::Resource to set a CPU limit, that only a 
runaway process would hit so the random killer process
doesn't accumulate and take down my system.  I have
MaxRequestsPerChild set to a few hundred and have found
empirically that they don't tend to take more than 10
seconds of CPU time for normal use, so I give a CPU 
limit of 20-30 seconds for all my httpds.

I also run a monitor program that watchdogs the
server every 20-30 seconds and restarts it if 
response time is ever too low, just in case other 
odd things go wrong. It just does a graceful 
restart, I haven't needed to fix a problem with a 
full stop / start yet.

-- Joshua
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NODEWORKS >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051


Stas Bekman wrote:
> 
> Hi,
> 
> Recently there were a few questions regarding hanging processes, I've
> tried to reproduce this case and have found two problems.
> 
> Let's take a little script that obviously "hangs" the server:
> 
>   my $r = shift;
>   $r->send_http_header('text/plain');
>   $|=1; # so we would see the $$ printed
>   print "OK $$\n";
>   sleep 1, $i++ while 1;
> 
> First question is: how do I detect that some server hangs? I've tried top,
> ps, /server-status -- none of them helped me to find that some process
> hangs. Of course if the process uses lot of resources you can bust it, by
> watching the top(), another approach is to use /server-status and watch it
> for about 5-10 minutes spotting which process number has the same number
> of requests while its status is 'W' (Which means that it hangs), but when
> you have about 50 procs, it's quite hard to spot such a process.
> 
> Another easy spotting is when some process trashes the error_log and
> writes millions of error messages there... But you still don't know the
> PID of this process, so you just restart all of them.
> 
> So my question is, is there any way to tell that some process hangs?
> Those who reported their processes hang, how did you spot it?
> 
> If I knew a programmatical way to spot the hanging process, I'd implement
> it in Apache::VMonitor to warn the admin and it would be possible to run
> watchdogs to kill off the process and report to admin... I think it would
> be a useful addon for us...
> 
> The second question is how comes that the above little script never quits
> after the stop button was pressed? Apache was supposed to detect SIGPIPE
> and abort the run... but it doesn't - it's very easy to reproduce - just
> run it... I've used $|=1 to print the $$ and check that it really hangs...
> 
> Thanks!
> 
> _______________________________________________________________________
> 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