hi,

        I've got a 2 tier apache setup running a lightweight apache with
mod_rewrite proxying *.pl requests to the heavyweight apache. I'm
posting this to share a bit of practical info on how to build such a
setup on a per-file basis, as the Guide only deals with per
domain/directory rewriting/proxying.

        The aim is to proxy requests to a mod_perl enabled apache running on a
high port, based on file extension, and enabling a transparent
transition from a monolothic one-apache setup to a 2 tier setup. As a
matter of fact, I keep a single apache on my dev box, and I'm upgrading
the production server to handle static + CGI + server-parsed content
with apache.plain, and proxy Registry and Embperl to apache.perl
(running on port 1800). Additionally, requests for any PHP content will
be proxied to apache.php at port 1801.

        To achieve this, I used to have in httpd.conf

RewriteEngine ON
RewriteLogLevel 3
RewriteLog /projects/webserver/logs/rewrite_log
RewriteCond %{REQUEST_FILENAME}  \.(pl|ehtml)$
RewriteRule ^/(.*)               http://%{HTTP_HOST}:1800/$1     [P]

        The issue is that PLAIN requests, that do not get proxied are getting a
performance hit because each hit executes 2 regexes on the URL: the
RewriteRule and the RewriteCond. At the beggining, I was horrified at
the performance, because I had logging on.  See:


Without Rewriting: 510 requests per second
With LogLevel 0: 418 req/s
With LogLevel 1: 365 req/s
With LogLevel 3: 300 req/s

Calling test.pl at port 1800: 85 req/s
Calling test.pl through proxy: 70 req/s

        One of the interesting things I found is that the statically compiled
apache.perl serves static content a little slower than the mod_so
(ENABLE_SHARED=MAX) apache.plain: 510 req/s against 470 req/s. My guess
is that the extra handlers that mod_perl registers slow down things a
bit more than the usage of mod_so (which the docs estimate to be 5%). 


martin

Reply via email to