In the recent Hello World 2000 benchmark posted by Joshua Chamas, mod_perl
handler was shown to be even faster than static HTML (at least for running
hello world), and twice as fast as using Apache::Registry to run a perl
script.

Does this mean that if there's a heavily used script on my system that
needs to be VERY fast, then it may be worth making it into a mod_perl
handler? What are the caveats of using mod_perl handlers instead of normal
scripts?

For those who didn't see it, here is the code for the Hello World mod_perl
handler program. It is inserted into httpd.conf directly.

<Files ~ (hello\.bench)>
    <Perl>
       # ModPerl Handler
         package Apache::bench;
         sub handler {
           my(\$r) = shift;
           \$r->content_type('text/html');
           \$r->send_http_header();
           \$r->print('Hello ');
           \$r->print('World');
           200;
         }
       1;
    </Perl>
    SetHandler perl-script
    PerlHandler Apache::bench
</Files>



Reply via email to