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

Re: [cobalt-users] RE: RAQ3 128MB - load average: 64.62, 73.63, 42.86



Dear Tony Cook,

Thank you very much. Below is the code of go.cgi
These script have to run when user click on link in my webboard.
I have 10,000 hits per day. Does RAQ3 can't handle it ?


#!/usr/bin/perl

use CGI;
$q = new CGI;

&CheckDetail;


############################### ReLocation #################################

print "Location: $URL \n\n";


############################### Count Hits #################################

if ( ! -e "dat/${DATE}.dat" || $URL eq "" )
{
	exit;
}


open(DATA,"+<dat/${DATE}.dat") or die;
flock(DATA,2);
@data = <DATA>;
seek(DATA,0,0);
foreach my $item (@data)
{ 
	$item =~ s/\r//;
	$item =~ s/\n//;
	next if ($item eq "");
	@items = split( /<f>/ , $item ); 
	$items[1]++ if ($items[6] eq $URL);
	print DATA join("<f>", @items[0..8], "\n");   
}
truncate(DATA, tell(DATA));
close(DATA);



################################ Save log ##################################

#if ( open(LOG,'>>dat/go.dat') )
#{
#	print LOG "$DATE<f>$URL<f>$IP<f>$ENV{HTTP_REFERER}<f>\n";
#}


############################ Check Submission ##############################

sub CheckDetail
{
	$DATE  =  substr( $q->param('DATE') , 0 , 10 );
	$DATE  =~ s/<//g;
	$DATE  =~ s/>//g;

	$URL   =  substr( $q->param('URL')  , 0 , 80 );
	$URL   =~ s/<//g;
	$URL   =~ s/>//g;

	$IP    =  $ENV{REMOTE_ADDR};
}


############################################################################

exit;


---------------------------------------- 8< ----------------------------------------

On 10/11/2001 at 6:35 PM tony cook wrote:

>
> RAQ3 128MB Upgrade RAM to 512MB can solve the problem ?
>

No, that won't be the problem in this case, load problems are a CPU issue,
too much load on the CPU.  A load average of 42.86 over 15 minutes means
that for the past 15 minutes, you've had, on average, 42 processes waiting
to be served by the CPU. Load average should be below 1 for over 15 minutes.
It might spike in the short term but should always be below 1 for 15 minute
averages.

The problem seems to be that "go.cgi" script that the support user is
running.  Delete that script fast and tell the user to write something less
taxing on the CPU.  Maybe it's doing too many file opens, or infinite loops
or other silly stuff.  Probably a perl script too.

If you want my advice - disable cgi scripts on your raq and tell users to go
learn PHP.  It's better for simple scripts anyway.

Hope that helps.

Ant

>
> 12:02pm up 1 day, 20:25, 3 users, load average: 64.62, 73.63, 42.86
> 257 processes: 188 sleeping, 57 running, 12 zombie, 0 stopped
> CPU states: 78.9% user, 21.0% system, 0.0% nice, 0.0% idle
> Mem: 127860K av, 125136K used, 2724K free, 182900K shrd, 2620K
> buff Swap: 131536K av, 38784K used, 92752K free 11004K cached
>

>
>   PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM
> TIME COMMAND
>  31278 tong      15   0   372  372    92 R       0 12.0  0.2
> 1:05 webalizer
>  2326 support   15   0  1652 1652   952 R       0  5.8  1.2   0:00 go.cgi
<<<<<<<<<<<<
>  2324 support   14   0  1652 1652   952 R       0  5.4  1.2   0:00 go.cgi
<<<<<<<<<<<<
>  2327 support   14   0  1656 1656   952 R       0  5.4  1.2   0:00 go.cgi
<<<<<<<<<<<<
>  2325 support   13   0  1652 1652   952 R       0  5.0  1.2   0:00 go.cgi
<<<<<<<<<<<<
>  31589 support    3   0  1196 1196   880 R       0  2.7  0.9   0:19 top
>   861 httpd      3   0  4380 1600  1268 S       0  0.3  1.2   0:00 httpd
>  1594 httpd      0   0  4596 1872  1352 S       0  0.3  1.4   0:00 httpd
>  2328 root      14   0   748  748   724 S       0  0.3  0.5
> 0:00 lcdstop
> 28919 httpd      3   0  4440 1696  1208 S       0  0.1  1.3   0:00 httpd
> 28975 httpd      1   0  4212 1408   892 S       0  0.1  1.1   0:00 httpd
> 30733 httpd      0   0  4452 1712  1200 S       0  0.1  1.3   0:00 httpd
> 32356 httpd      3   0  4612 1920  1372 S       0  0.1  1.5   0:00 httpd

_______________________________________________
cobalt-users mailing list
cobalt-users@xxxxxxxxxxxxxxx
To Subscribe or Unsubscribe, please go to:
http://list.cobalt.com/mailman/listinfo/cobalt-users