Hi All,
Our company planning to move from Perl/CGI to mod_perl.
But when we test, mod_perl is slower than mod_cgi.

I test with these script:

        # TESTING SCRIPT 1
        use Time::HiRes qw(usleep ualarm gettimeofday tv_interval); 
        $t0 = [gettimeofday]; 
                # CODE HERE 
        $t1 = [gettimeofday]; 
        $t0_t1 = tv_interval $t0, $t1; 
        $elapsed = tv_interval ($t0, [gettimeofday]); 
        $elapsed = tv_interval ($t0); 
        print "$elapsed sec\r\n"; 
And
        # TESTING SCRIPT 2 
        use Benchmark; 
        timethis (1000, 
                sub { 
                # CODE HERE 
                } 
        );

Both result are same, mod_perl is slower than mod_cgi.

How to make it faster?
I already tried to pre-load the modul when apache start with startup.pl but 
no effect.

Here is my httpd.conf

Alias /perl/ /var/www/cgi-bin/
Perlrequire /var/www/cgi-bin/startup.pl
PerlModule Apache::Registry
<Location /perl>
        SetHandler perl-script
        PerlHandler Apache::Registry
        Options ExecCGI
        allow from all
        PerlSendHeader On
</Location>

Here is my startup.pl

#/usr/bin/perl
use strict;

# make sure we are in a sane environment.
# ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";

use Apache::Registry(); # for things in the "/programs" URL

# pull in things we will use in most requests so it is read and compiled
# exactly once
use Apache::RegistryLoader();
Apache::RegistryLoader->new->handler("/perl/timeres.pl","/var/www/cgi-bin/timeres.pl");
use CGI (); CGI->compile(':all');
#use CGI::Carp ();
use DBI ();
use DBD::mysql ();

1;

Any help would be appreciate.


Thank you,

Ricky

Reply via email to