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

In reply to FastCGI and mod_perl compared by mandog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.