15

I'm developing a web app in Perl with some C as necessary for some heavy duty number crunching. The main problem I'm having so far is trying to decide if I should use mod-perl, mod-fastcgi or both to run my scripts because I'm having a difficult time trying to analyze the pros and cons of each mod.

Can anyone post a summary or give a link where I can find some comparison information and perhaps some recommendations with examples?

3 Answers 3

24

They are quite different beasts.

mod_fastcgi (by the way, mod_fcgid is recommended) just supports the FCGI protocol to execute CGIs faster with some knobs to control how many processes will it run simutaneously and not much more.

mod_perl, on the other hand is a platform for development of applications that exposes most Apache internals to you so you can tweak every webserver knob from your code, accelerates CGIs, and much more.

If all you wish is to run your CGIs quickly, and want to support as many hosts as possible, you should stick with supporting those two ways to run your code and probably standard CGI as well.

If you care about maximum efficiency at the cost of flexibility, you could aim for a single platform, probably mod_perl.

But probably the sanest option is to run everywhere and use a framework to build the application that'll take care of using the advantages of a particular way of executing if present, like Catalyst.

1
  • It appears that the Catalyst framework has moved.
    – Adam Ness
    Oct 16, 2011 at 4:21
7

I would advise you to use a framework such as Catalyst that takes care of such details. For most applications, it doesn't matter how the program connects to the webserver, as long as it is done in an efficient way. The choice between mod_perl and FastCGI should be made by the sysadmin who deploys it, not the developer.

3
  • 9
    I disagree that it should be the job of the sysadmin. If you the programmer want to have access to Apache internals to give your product an edge that's your decision, not the machine's administrator. Hopefully your org is setup so that sysadmins support the product, not the other way around.
    – mpeters
    Dec 20, 2008 at 17:29
  • If your application is the core of your business, then I agree, but in many cases that is not the case and you have to do with the existing infrastructure. Dec 20, 2008 at 22:10
  • 6
    This is a product endorsement more than an answer. You're not answering the question of how do fastcgi and mod_perl compare.
    – Hawken
    Jul 31, 2012 at 20:48
5

Here is a site with some actual performance comparisons of mod_perl, mod_fastcgi, cgi (Perl) and a Java servlet - for a very basic script: https://sites.google.com/site/arjunwebworld/Home/programming/apache-jmeter

In summary:

cgi - 1200+ requests per minute
mod_perl - 6000+ requests per minute (ModPerl::PerlRun only)
fast_cgi - 6000+ requests per minute
mod_perl - 6000+ requests per minute (ModPerl::Registry)
servlets - 2438 requests per minute.

There is an old thread on PerlMonks comparing mod_perl and fastcgi here: http://www.perlmonks.org/?node_id=108008

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.