http://www.perlmonks.org?node_id=108008

This recent thread on improving performance contained a node by mugwumpjism that got me thinking about CGI performance. So to feed my thoughts, I poked around the net a bit and came to the conclusion that:

  1. A good (relatively quick & easy, effective) way for me (a novice) to improve performance on my site & server is to use mod_perl and Apache::Register.
  2. For my purposes, mod_perl and Apache::Register is better than FastCGI

Since I started the afternoon predisposed to notice facts that supported my mod_perl prejudice, I thought it best to get a couple second opinions before installing mod_perl and modifying my scripts based on the information that follows.

Both FastCGI and mod_perl achieve their speed-up by avoiding the overhead of starting a process for each CGI request. This overhead is apparently more noticeable with perl CGI scripts than with compiled C programs. A Perl script has to be re-compiled each time it is run. Speed increases of 400 to 2000 percent are claimed.

Both FastCGI and mod_perl claim benefits beyond speed-up. As a novice I don't understand what many of these features are but according to this chart, mod_perl has more of em.

mod_perl seems to have wider support and more active development.

A FastCGI super search turned up about (8) nodes. My down arrow finger got tired scrolling through all the mod_perl nodes on perlmonks.org

Via google I turned up a few external nodes comparing FastCGI to mod_perl. Several people remarked that they'd found FastCGI support lacking.

FastCGI is no longer bundled with Apache. At modules.apache.org, the page for the FastCGI module was last updated three years ago and the link to the module's page is broken.

The process for installing mod_perl looks clear to me.
  1. Double check the instructions and mod_perl traps
  2. Triple check that I'm at running recent enough versions of Perl, Apache and CGI.pm
  3. su
  4. apt-get install libapache-mod-perl
  5. Edit my CGI scripts to replace print() statements with My_CGI.pm_Object->print()
  6. Copy and paste 5 lines into my httpd.conf
  7. apachectl graceful

The process for installing FastCGI looks a little scary. The docs begin something like: "...you need a FastCGI-savvy version of Perl..." There doesn't seem to be a debian package for FastCGI...

While they aren't relevant to my situation, FastCGI does seem to have strengths that mod_perl lacks.

  1. You can't use mod_perl for C, TCL or Python programs
  2. You can only use mod_perl on apache
  3. It might be easier to run the webserver and CGI programs on separate boxes

I'm not clear on how big a feature the last point actually is. Is there a big difference between running (4) Apache/mod_perl boxes and a database box and running (2) FastCGI boxes, (2) Apache boxes and a database box?

--mandog