VML wrote:
> 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.

Oh, boy, this is a wrong test :) You benchmark the code execution and 
not mod_perl against mod_cgi. You should use ab(8) or similar app for this.
To learn how to properly do this and much more see:
http://perl.apache.org/guide/performance.html

p.s. also remember that doing wallclock benchmarking as in SCRIPT 1 on 
multitask system  can give you very incorrect results, if you load is 
different during two subsequent benchmarks.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to