You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by James G Smith <JG...@TAMU.Edu> on 2001/04/09 03:03:23 UTC

Re: deploying tips running 2 apache server

"rene mendoza" <re...@iaxnetworks.com> wrote:
>This is a multi-part message in MIME format.
>
>------=_NextPart_000_0044_01C0BF6F.A24D64B0
>Content-Type: text/plain;
>	charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
>i ve been reading the mod perl guide and ive learned that i dont want to =
>use apache child processes to serve static html or images, so i want to =
>implement a lightweight (only mod_dav and cgi enabled apache server, =
>lots of child processes) and a heavy mod perl apache server 5 or 10 =
>apache processes/=20
>
>does anybody has pointers, or tips of where to start? how to configure =
>that only static content of a virtual host goes thru one server and =
>dynamic goes thru another.
>
>im using Mason in the mod_perl enabled apache
>
>is it done with mod_rewrite?, should both servers be ssl enabled?

Short answer first: 

Rewrite rules can do almost anything the proxy module can do 
except cache results and provide reverse proxying.  With proper 
configuration, the only server that should need SSL is the
proxying server the client interacts with.

Long answer: 

http://perl.apache.org/guide/strategy.html#Adding_a_Proxy_Server_in_http_Ac

My most recent experience:

We aren't using mod_perl (unfortunately), but we are using 
mod_php for our central email system (web interface for it).  We 
found that we get a performance boost by using two Apaches.  

The Apache+mod_php process listens on port 80 and redirects any 
requests for php pages to the Apache listening on port 443 (https).

A lightweight Apache (mod_rewrite, mod_proxy, mod_ssl) listens on 
port 443.  Most requests will come to this server since only the 
initial request in a session will arrive at port 80.

The following ascii art illustrates how the systems work together:

   +--------+
   | client |
   +--------+
      |
      | (request)            /html/*
      |      +----------+    /MBX/*     +---------+
      +----> | port 443 | ------------> | WebMail |
             +----------+               +---------+
                  | *.php3
                  | *.php      +---------+
                  +----------> | port 80 |
                               +---------+

The server at port 443 will proxy requests - any php scripts get 
sent to port 80 to be filled, and any requests for /MBX/* or 
/html/* get sent to the WebMail installation.  This setup was put 
in place to allow testing of WebMail without requiring people 
learn a new URL.  The side-effect was a speedup in the server.  
Requests for static files (non-php files) on the site are served 
directly to the client.  The response flows back the same way the 
request arrived.

Except for the WebMail proxying, all the proxying can be 
accomplished with rewrite rules.  If reverse proxy rules are not 
required and all the proxied material is dynamic, then mod_rewrite 
should be sufficient.  This caln allow for a lighter front end.

For now, we allow 35 lightweight servers and 30 heavy servers.  
We used to have 38 heavy servers, but by giving up 8, we had more 
than enough memory left to hold 35 light ones, and the system 
became more responsive.  Except for a few peaks at noon, this is 
sufficient.  We serve around a terabyte of data per day with 
88,500 requests for pages/day.  This is about a third to a fifth 
of our target customer base.  We will probably move the port 80 
server to separate hardware and up the port 443 server count, but 
currently our web server, mailstore, imap and pop3 daemons run on 
the same machine.

Configuration is fairly simple -- we have a few rewrite rules and 
a couple proxy rules for the port 443 server and the usual 
configuration for the port 80 server.  The only server requiring 
special configs is the proxying server.  Quoting the 
configuration here wouldn't really help any since it really 
depends on the site.
-- 
James Smith <JG...@TAMU.Edu>, 979-862-3725
Texas A&M CIS Operating Systems Group, Unix