Mike Ward wrote:
> I'm rather new to mod_perl, so there's my disclaimer.
> 
> When I learned perl CGI stuff, it was always done with CGI.pm. All the
> example scripts, etc, in the book were done that way. Sending headers,
> for example , was done like so:
> 
> my $query = CGI->new();
> print $query->header();
> 
> rather than the style of:
> 
> $r->send_http_header();
> 
> 
> Is this going to run more slowly, or is there much of a performance
> differance, or what differance does it make, exactly? The server is
> still running mod_perl, but will not take full advantage of the
> increased speed if I'm not using it's apache api (I intend to learn
> and start using it anyway, I'm just curious as to the question).

ok, there are really three levels to CGI scripts when it comes to mod_perl.

level 1 is standard CGI via mod_cgi (what you have probably done to date)

level 2 is mod_perl via Apache::Registry.  Apache::Registry is a mod_cgi
emulator that allows you to take advantage of mod_perl's speed while still
using legacy CGI tools - essentially allowing you move CGI unaltered scripts
between mod_cgi and mod_perl for performance gain (for some definition of
unaltered :)

level 3 is using Apache::Registry as a way to dispatch scripts written using
the mod_perl API, at which point you cannot move them back over to mod_cgi.

outside of CGI scripting are mod_perl handlers (a fourth level), which use
the mod_perl API at various points in the apache request lifecycle
(including content generation).

now, between level 2 and level 3 I'm not exactly sure what the performance
gains would look like (and I don't think it's covered in
http://www.chamas.com/bench/) , but it probably isn't significant enough to
worry about as part of an initial migration step.  I suspect that the real
gains to be had in using the API are that you can drop things like the param
parsing of CGI.pm in favor of tools like Apache::Request, but getting the
initial boost from Apache::Registry might be all that you need, depending on
the size of your application.

HTH

--Geoff

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to