Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is mod_perl?

Apache

What is mod_perl?

by  MikeLacey  Posted    (Edited  )
Please browse through faq219-2884 and faq219-2889 first. Comments on this FAQ and the General FAQ's are very welcome.

mod_perl integrates Perl and Apache. It's usuallly seen, essentially, as a way of speeding up Perl on a website. The following is from the Apache/mod_perl documentation.

[quote ApacheDocumentation]
The Apache/Perl integration project brings together the full power of the Perl programming language and the Apache HTTP server. With mod_perl it is possible to write Apache modules entirely in Perl, letting you easily do things that are more difficult or impossible in regular CGI programs, such as running sub requests. In addition, the persistent Perl interpreter embedded in the server saves the overhead of starting an external interpreter, i.e. the penalty of Perl start-up time. And not the least important feature is code caching, where modules and scripts are loaded and compiled only once, then for the rest of the server's life they are served from the cache, thus the server spends its time only on running already loaded and compiled code, which is very fast.

The primary advantages of mod_perl are power and speed. You have full access to the inner workings of the web server and can intervene at any stage of request-processing. This allows for customized processing of (to name just a few of the phases) URI->filename translation, authentication, response generation, and logging. There is very little run-time overhead. In particular, it is not necessary to start a separate process, as is often done with web-server extensions. The most wide-spread such extension, the Common Gateway Interface (CGI), can be replaced entirely with Perl code that handles the response generation phase of request processing. mod_perl includes 2 general purpose modules for this purpose: Apache::Registry, which can transparently run existing perl CGI scripts and Apache::perlRun, which does a similar job but allows you to run ``dirtier' (to some extent) scripts.

You can configure your httpd server and handlers in Perl (using PerlSetVar, and <Perl> sections). You can even define your own configuration directives.

Many people wonder and ask ``How much of a performance improvement does mod_perl give?'. Well, it all depends on what you are doing with mod_perl and possibly who you ask. Developers report speed boosts from 200% to 2000%. The best way to measure is to try it and see for yourself! (See http://perl.apache.org/tidbits.html for the facts.)
[/quote]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top