Hagbone has asked for the wisdom of the Perl Monks concerning the following question:

Oh wise ones ....

I am having a Linux box configured, and have received different opinions on how best to configure mod_perl. While I have a working knowledge of Perl, actual box configuration is beyond my abilities. I've been trying to read up (and ask others) on the different approaches to configuring mod_perl, and am receiving different opinions. I'm posting this question in the hopes that some participants can shed some more light on this issue.

The core question I have involves two approaches to the configuration:

The first is a configuration with one instance of Apache, and two "cgi-bin" areas. Scripts that don't use mod_perl will point to the non-mod_perl cgi-bin area, and scripts that do use mod_perl will point to a separate cgi-bin area with mod_perl enabled.

The second approach involves configuring the box with two instances of Apache. Non mod_perl scripts and static pages will run in the Apache (at port 80, I believe), and scripts that use mod_perl will run in the second instance of Apache (which I believe will be running on a different port).

Here's the advantages and disadvantages to both approaches that have been offered:

Single instance of Apache .... the advantages are simplicity, no network changes, and speed. Disadvantages are large process size for static requests as well as dynamic requests, excessive RAM consumption, outputs to clients with slow connections ties up the processes.

Two instances of Apache ... advantages are static content is served without the mod_perl overhead (Apache instance 1) and larger mod_perl enabled processes are limited to specific scripts (Apache instance 2). Disadvantages are increased administration overhead - two config files and controlling scripts, merging two log files.

I may not have correctly articulated some of the technical explanations above, but again, my understanding of this issue is limited. I'm trying to get some input on the merits of which approach will best suit my needs. Some other related info:

The box has dual 2400 Mhz processors with a Gig of RAM each. The dynamically served pages represent %50-%60 of the data transferred.

My best shot at boiling all this into one sentence: Does the added complexity of a two-Apache configuration offer performance improvements/overhead-reduction that make the complexity worthwhile?

  • Comment on mod_perl - choosing best server configuration

Replies are listed 'Best First'.
Re: mod_perl - choosing best server configuration
by domm (Chaplain) on Mar 19, 2003 at 14:57 UTC
    My best shot at boiling all this into one sentence: Does the added complexity a two-Apache configuration offer performance improvements/overhead-reduction that make the complexity worthwhile?

    It depends :-)

    Did you read what the mod_perl guide has to say on this issue? If not, do it now: Choosing the Right Strategy is a very complete and helpful document.

    Besides that, it really depends on your traffic. I never cared to set up a reverse-proxy (because my servers work fine without it), but if I ever get the feeling that the servers got slow, I'd implement it.

    For some advanced setup issues, perrins articel Building a Large-Scale E-commerce site with Apache and mod_perl is a good read, too.

    -- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
Re: mod_perl - choosing best server configuration
by shotgunefx (Parson) on Mar 19, 2003 at 14:49 UTC
    I suppose the first question would be what do you intend to run on it? I would think you would want a single server and without a substantial reason to avoid this I think it's the way to go. OTOH, if you plan to run mostly CGI scripts and have some really large funky limited use handlers then by all means run 2 copies.

    If you are not preloading tons of modules I don't think the overhead increase would be much at all.

    -Lee

    "To be civilized is to deny one's nature."
Re: mod_perl - choosing best server configuration
by perrin (Chancellor) on Mar 19, 2003 at 15:17 UTC
    Your understanding is correct. If you don't expect lots of traffic, start with the simpler setup. It's not hard to switch it later.
Re: mod_perl - choosing best server configuration
by Hagbone (Monk) on Mar 19, 2003 at 18:32 UTC
    .... Hits would be in the neighborhood of 8,000,000 per month, 300,000 per day
Re: mod_perl - choosing best server configuration
by Hagbone (Monk) on Mar 19, 2003 at 16:02 UTC
    FWIW, expected data transfer is 100-150 gigs a month.
      From what I've seen, the load is not so much data size as number of hits. If you did all that data with five hits per day, you could pretty much run it on a 100Mhz machine. {grin}

      I'm running http://www.stonehenge.com with a reverse-caching proxy, using Apache for the "thin" front end to handle cached and a bit of static data, proxying through to a mod_perl enabled Apache for the "thick" back end. I'm very happy with this arrangement, because it gives me a lot of room to define caching policies and static data policies.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.