[ic] mod_interchange and Apache MaxClients

Ron Phipps rphipps at reliant-solutions.com
Thu Nov 17 11:22:13 EST 2005


> From: interchange-users-bounces at icdevgroup.org
[mailto:interchange-users-
> bounces at icdevgroup.org] On Behalf Of John1
> Sent: Thursday, November 17, 2005 3:12 AM
> 
> On Thursday, November 17, 2005 7:02 AM, rphipps at reliant-solutions.com
> wrote:
> 
<snip>
> 
> ######## Snippet
> my $browser = LWP::UserAgent->new;
> $browser->timeout(30);
> 
> my $count = 0;
> my $up = 0;
> 
> while ($count <= 4) {
>         my $response = $browser->get($url);
>         if ($response->content =~ m/UP/) {
>                 $count = 5;
>                 $up = 1;
>         }
>         $count++;
> }
> ##########
> 
> Ron, does this code mean that it takes your script 2.5 minutes to
> recognise
> that the server is down (i.e. 5 x 30 seconds timeout?)  If so, would
it be
> better if we reduced the timeout to about 5 seconds.  Hopefully 5
tries
> with
> a 5 second timeout shouldn't cause any false alarms?  That way we will
> spot
> the server going down quicker and the various system commands I have
> suggested inserting may then give more useful information.  Perhaps we
can
> get away with less than a 5 second timeout - what do you think?
> 
> BTW, I have thise running via cron at a 1 minute interval - are you
doing
> the same?  Thanks
> 

I actually only have mine go through 3 times to check, so 90 seconds to
determine if it's down, running every minute in cron.  We probably could
reduce the timeout value, however under a heavy load I wanted to give IC
plenty of time to respond.  Not sure what the ideal values would be.
Another idea would be to capture the results of those commands at the
beginning of the script and then email them if the site is down, that
way you get the output before you know if there is a problem.  Or reduce
the timeout to something like 10-15 seconds, capture that output the
first time you see the page is down so the data is only 1-15 seconds
old.  I think I'll go for the second option.

Thanks,
-Ron

Here's the new code:

my $output = '';

while ($count <= 4) {
        my $response = $browser->get($url);
        if ($response->content =~ m/UP/) {
                $up = 1;
                $count = 5;
        } elsif ($output == '') { 
                $output = `$REPORT_COMMAND`;
        }
        $count++;
}
    
if ($up == 1) {
} else {
        system $IC_COMMAND;
        mail_admin("IC483 restarted! $output");
        print "IC483 restarted!";
}



More information about the interchange-users mailing list