[Melbourne-pm] Mod_perl2

Andrew Speer andrew.speer at isolutions.com.au
Wed Sep 13 20:12:59 PDT 2006

On Thu, September 14, 2006 11:35 am, Scott Penrose wrote:
> Hey Guys
> .. snip ..
> The sort of topics I would like to cover are:
> * Why should you use mod_perl
> * Why should you use mod_perl2
> * Why should you not use mod_perl
> * Processing Parameters, Environment Variables and Headers - in
> Content and Filter handlers (and other stages)


I am from Adelaide, so was not able to make the meeting. It may have been
covered, but one of the issues I seen when using mod_perl(2) is memory
usage per connection.

When using Apache with mod_perl processes can easily grow to 10M+ (or
more, depending on the app). If the site/app suddenly becomes subject to a
high load Apache will spawn more processes to service the load. Unless you
have given very careful consideration to memory utilisation the server can
easily be swamped by Apache processes needing more memory than is
physically available. The server starts swapping and performance suffers

There are ways and means around this problem, but they all seem a bit
kludgy - front-end proxy servers, multiple Apache servers (Apache with
mod_perl for dynamic content, straight Apache for static content).

If your main need is content-phase dynamic content (a big part of most
mod_perl apps) you may want to have a look at lighttpd + fastCGI and the
CPAN FastCGI module. lighttpd spawns as many Perl FastCGI processes and
you want, and only sends requests to them if dynamic content generations
is required - as opposed to Apache, which in the "default" mod_perl config
will handle both static and dynamic content - ie you may have a 10M+
process tied up sending down a JPEG or CSS file.

If you want to do tricky stuff outside the content generation phase then
mod_perl is still one of the best/easiest ways to extend Apache with Perl.

Anyway, there are heaps of resources on the Internet discussing these sort
of issues, but a dedicated mod_perl wiki does sound like a good idea.

Now for a shameless plug of my mod_perl framework. Have a look at
http://webdyne.org/ for my implementation of YAPWF (Yet Another Perl Web
Framework). It started off as a mod_perl implementation, but now runs
under IIS/lighttpd and FastCGI also.


Andrew Speer

More information about the Melbourne-pm mailing list