in reply to Benchmarks of mod_perl

The big speed boost you get with mod_perl over traditional CGI isn't really in the execution speed of the code. It's in the fact that the webserver doesn't have to start a new Perl interpreter and compile the script for each CGI request. So "mod_perl code" doesn't, in one good sense, run any faster than the code outside mod_perl. For fine-tuning your code, you probably want to use a combination of Benchmark and something like Devel::DProf. (note: that will only help you test out the efficiency of various algorithms; but since the integration of Perl and Apache that is mod_perl is a different environment from that of traditional CGI , it's not so obvious that you'll be able to port conclusions about how fast this script is as traditional CGI to how fast it will be under mod_perl directly; mod_perl is much more powerful than traditional CGI, which is a reason to use it independent of any speed gain)

Given that mod_perl is helping you serve web pages, the best way to measure it is to simulate an actual setup and see how it deals with it. Write a script that uses LWP to make requests to the server, and see how many pages it can serve up in a given interval. That's probably the only way to test the relative speed of mod_perl vs. say, PHP or JSP or ... $dynamic_web_content_technology

HTH

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Replies are listed 'Best First'.
Re: Benchmarks of mod_perl
by deadkarma (Monk) on Mar 02, 2001 at 22:47 UTC
    Writing a CGI program with mod_perl is more complex than writing a CGI program with perl. It was a very daunting task for me to have to 'port' my code over to mod_perl.What I did instead was use a module called Apache::PerlRun, you won't get the same performance increase as if you written your CGI with mod_perl, but if helps.

    What I think it does is compiles your perl code and keeps it resident in memory.

    here's the entry in my httpd.conf:

    <Location /cgi-bin> SetHandler perl-script PerlHandler Apache::PerlRun PerlSendHeader On Options +ExecCGI </Location>