Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

lilstevey (4628)

lilstevey
  (email not shown publicly)

Consumes:
  • Heinekin
  • Kro
  • Addlestones
  • Old Rosie
  • Thatchers
  • Strongbow
  • Erdinger
  • Guiness
  • Budvar
  • Leffe ( usually blond )
  • Various Real Ales when in premises suitable

Journal of lilstevey (4628)

Sunday January 18, 2004
10:18 AM

Apache 2.0 Thick/Thin

[ #16887 ]
I quite like the widely covered thick/thin model for apache/mod_perl configeration, and I've been doing a little playing to try to find out if its possible to do something similar using port based virtual hosts. Whilst I doubt that it will be as beneficial as running seperate instances of apache, and don't know enough to comment, it looks like it could be usefull for my development environment.

# Minimal Reference Example

ServerRoot "/home/user/httpd"

<IfModule !mpm_netware.c>
    PidFile logs/httpd.pid
</IfModule>

Timeout 300

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
    StartServers         5
    MinSpareServers      5
    MaxSpareServers     10
    MaxClients         150
    MaxRequestsPerChild  0
</IfModule>

LoadModule perl_module modules/mod_perl.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

DocumentRoot /home/user/httpd/htdocs

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

<Directory "/home/user/httpd/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

ServerAdmin you@example.com
DirectoryIndex index.html
DefaultType text/plain
TypesConfig conf/mime.types
HostnameLookups Off
ServerTokens Full

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Now for virtual servers

Listen 7188
Listen 7180

# First the 'Thin' Virtual Server

<VirtualHost *:7188>

    CustomLog    logs/access.log    common
    ErrorLog    logs/error_log
    LogLevel    warn

    ProxyRequests Off

    <Proxy *>

        Order deny,allow
        Allow from all

    </Proxy>

    ProxyPass /scripts http://localhost:7180/
    ProxyPassReverse /scripts http://localhost:7180/

</VirtualHost>

# Now for the mod_perl enabled one

<VirtualHost *:7180 >

    ErrorLog    logs/perl_error_log
    LogLevel    warn

    Include conf/mod_perl_app.conf

</VirtualHost>

where mod_perl_app.conf contains:

PerlRequire "/home/user/httpd/conf/startup.pl"

PerlModule MyApache::PrintEnv2
<Location /print_env2>
    SetHandler modperl
    PerlResponseHandler MyApache::PrintEnv2
</Location>

And PrintEnv2 is the printenv example off of the mod_perl website. Whilst I haven't given it a proper shake down yet, intially, as far as my linux based development environment goes ( the ports and directories might give this away ) it looks promising.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • How did your think/thin Apache2 experiment go? Google only found this journal entry, where have you seen this technique used before?

    --
    -- "It's not magic, it's work..."
    • I can't remember getting too far futher with it to be honest. I've configered Apache 1.3 with the thick/thin setup a couple of times, using either seperate binaries, or two different shell scripts to run two apaches from the same binary ( using DSO's for the relevant modules ) - This is quite heavily documented, but may not be what you are looking for ( perl.apache.org [apache.org] ), along with using squid for the same purpose, although I have an irrational fear of squid, so have never used that configeration.

      I seem
      • I've seen the technique advocated a number of times, either a simple Apache front end or with a dedicated Squid proxy, and the a complex heavy Apache/mod_perl backend. I've never actually tried it myself, hence my interest in your experience.

        My feeling was that as Apache shares mod_perl memory so to run Apache/mod_Perl in think/thin you'd need to run two instances rather than two virtual servers in the same instance, though I'd like to be proved wrong.

        The kernel server you are think of is called TUX [redhat.com], an

        --
        -- "It's not magic, it's work..."
        • I may be revisiting this area soon, so I'll let you know how I get on. I'm not ready to throw mod_perl 1.9x/2.0RC into production yet, but I'm yet to decide between a fat apache 1.3 and apache 2, or a dual apache 1.3 config.

          My gut feel was that I wouldn't save any memory by using the thick thin virtual server config ( though I probably ought to check ), but I'm a bit cautious when it comes to testing, and often have multiple versions of the same mod_perl app running on different apaches on the same physi