Why a program ran with mod_perl runs slower?

From: Octavian Rasnita (orasnita_at_fcc.ro)
Date: 12/24/04


To: <beginners@perl.org>
Date: Fri, 24 Dec 2004 11:33:24 +0200

Hi all,

I have tried testing mod_perl with the following script:

my $begin = (times)[0];
print "Content-type: text/html\n\n";

sub fib {
$_[0] < 2 ? return $_[0] : return fib($_[0] - 1) + fib($_[0] - 2);
}

$f = fib(29);
my $end = (times)[0];
print($end - $begin);

--
Well, if I run this script as a common CGI application, it usually runs
faster with 10% than if I run it using mod_perl.
(Under Windows 2000, mod_perl 2 with Active Perl 5.8.4).
I know that the advantage of mod_perl is that it doesn't require time for
creating a new process and for the example above the time needed for
starting the process is much lower than for running the entire program, but
does this mean that mod_perl doesn't lose the time for starting a new
process, but it executes the program slower?
Or why does the program runs slower with mod_perl?
I have also tried to put a:
PerlRequire f:/web/presafierbinte/perl/benchmark.pl
In the corresponding virtualhost section in httpd.conf, in order to preload
this program at the server start, but it didn't change anything.
Thank you.
Teddy


Relevant Pages

  • Re: Why a program ran with mod_perl runs slower?
    ... > sub fib { ... > Well, if I run this script as a common CGI application, it usually runs ... but it executes the program slower? ...
    (perl.beginners)
  • Re: Why a program ran with mod_perl runs slower?
    ... Well, if I run this script as a common CGI application, it usually runs faster with 10% than if I run it using mod_perl. ... I know that the advantage of mod_perl is that it doesn't require time for creating a new process and for the example above the time needed for starting the process is much lower than for running the entire program, but does this mean that mod_perl doesn't lose the time for starting a new process, but it executes the program slower? ... University of Papua New Guinea ...
    (perl.beginners)
  • centOS 5.0 and Apache installation with Suexec setting
    ... configuration for the VirtualHost, inside VirtualHost, it is a cgi- ... script directory that will be used to run cgi script that created in ... the browser complaints about the 500 Internal Server Error, ...
    (comp.os.linux.misc)
  • Re: Concurrent connections from single IP to same VirtualHost?
    ... refresh the log output in a separate window. ... use a separate VirtualHost, but if I use the same VirtualHost my log ... if a script keeps the session file locked other scripts ...
    (comp.infosystems.www.servers.unix)