httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Banan...@grabbarna.nu>
Subject RE: [users@httpd] Count in SSI
Date Tue, 01 Apr 2003 09:10:38 GMT
I tested by rewriting my index.shtml into a cgi-script (index.cgi) and the 
result is exactly the same... the client requests a new page as soon as 
possible after it has received the previos page and it takes about 4-5 
secs between each page. 

When using a simple index.shtml with no perl-calls it takes no more than 
one second, so there seem to be no problem with SSI, the problem seem to 
be that apache 1.3.27 takes seconds to start/stop executing a perl-script 
with mod_perl/1.27.

Any suggestions of how to fasten this up are very welcome!!

/Jan

On Tue, 1 Apr 2003, Jan Banan wrote:

> I am using modperl: Server: Apache/1.3.27 (Unix) PHP/4.2.3 mod_perl/1.27
> I rewrote the perl-script like this:
> 
>    #!/usr/local/bin/perl
>    use Time::HiRes qw(gettimeofday tv_interval);
>    $t0 = [gettimeofday];
>    ($sec, $min, $hour)=localtime(time-2);
>    $year += 1900;
>    $mon++;
>    print "Content-Type: text/plain\n\n";
>    print (sprintf ("%.2d%.2d%.2d", $hour, $min, $sec));
>    $t1 = [gettimeofday];
>    $t0_t1 = tv_interval $t0, $t1;
>    print STDERR "Time diff: $t0_t1\n";
> 
> This is the time diffs I get in Apache error_log:
> 
>   Time diff: 0.000337
>   Time diff: 0.000339
>   Time diff: 0.000348
>   Time diff: 0.000366
>   Time diff: 0.000333
> 
> So the perl-script seem to execute really fast. But what may take time is 
> the SSI line:
>    <!--#include virtual="/cgi-bin/slow_clock.pl" -->
> because the client webbrowser is sending a GET every second but it only 
> receives a result every 4-5 second.
> If I change the SSI line to
>    <!--#config timefmt="%H%M%S" --><!--#echo var="DATE_LOCAL" -->
> (so I am not able to slow the clock my 2 secs) then the client get a 
> respons each second (as I want).
> 
> So either there seem to be something really slow with SSI
>    <!--#include virtual="/cgi-bin/slow_clock.pl" -->
> or for Apache to start/stop using Perl.
> 
> Any suggestions are very welcome!!
> 
> /Jan
> 
> On 31 Mar 2003, Garth Winter Webb wrote:
> 
> > Are you running mod_perl?  A request to this CGI should definitely not
> > take a few seconds.  It shouldn't even take a second.  The speed of your
> > machine is not at issue here.  I've got a PII 300MHz machine serving
> > content from multiple scripts that do way more than this one and the
> > response is less than a second.
> > 
> > Use mod_perl if you not already.  You could load Time::HiRes from your
> > script, record the time at the beginning and at the end and write the
> > difference to STDERR which you can pick up in your log file.  By using
> > mod_perl you won't incur a hit for loading Time::HiRes (or Perl, or any
> > module it uses for that matter) after the first hit.  This will tell you
> > how much time is being spent running your script.
> > 
> > G
> > 
> > On Mon, 2003-03-31 at 09:17, Jan Banan wrote:
> > > > You have to call an external program which may be in CGI, e.g.
> > > >         <!--#include virtual="/cgi-bin/slow_clock.pl" -->
> > > > where slow_clock.pl always returns the time of two seconds ago.
> > > 
> > > I did that by creating the following /cgi-bin/slow_clock.pl :
> > > 
> > >    #!/usr/local/bin/perl
> > >    print "Content-Type: text/plain\n\n";
> > >    ($sec, $min, $hour)=localtime(time-2);
> > >    print (sprintf ("%.2d%.2d%.2d", $hour, $min, $sec));
> > > 
> > > The problem is that this is extremely slow. I like the user to be able to 
> > > send/receive a GET every second, but each request takes a few seconds to 
> > > execute on this 550 MHz Pentium III running RedHat Linux 7.2 and Apache 
> > > 1.3.27 :-( 
> > > Probably I need to buy a faster computer... or just put the clock back 
> > > two seconds, hrm.
> > > 
> > > /JB
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > The official User-To-User support forum of the Apache HTTP Server Project.
> > > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message