modperl-tuning_for_speed_with_vhosts

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



To: webmaster@perl.apache.org
From: "Tyler 'Crackerjack' MacDonald" <tyler@yi.org>
Subject: how to make mod_perl actually run fast
Date: Mon, 3 Dec 2001 13:45:05 -0800

[mod_perl list: i'm not a subscriber jsyk so if you wish to reply to me,
reply to me directly and not the list]

This past weekend, my webserver suffered a severe failure when i decided to
upgrade my code to mod_perl instead of fastCGI. This performance problem
resulted in me going to the mod_perl performance tuning guide. Reading this
guide made me think "damn, that's inconvienent for a bunch of VHosts".
Thinking this made me write the following artice:

http://www.weedns.com/apache_tuning/fast_mod_perl_mini_howto.html

It uses wildcard DNS and some other goodies to extend the
mod_perl-server-via-proxy-from-static-server setup that is already partially
documented in the performance tuning and general guides on the
perl.apache.org website.

It's relevant to apache 1.3 because I got an even bigger headache trying to
make modperl2+apache2 run.

Feel free to link to it or integrate it's ideas into your own documentation
if you wish.

Cheers,
Tyler

===

To: "Tyler 'Crackerjack' MacDonald" <tyler@yi.org>
From: Roger Pettett <rmp@sanger.ac.uk>
Subject: Re: how to make mod_perl actually run fast
Date: Wed, 5 Dec 2001 09:49:10 +0000 (GMT)

My configuration had a similar problem - 
a bunch of virtualhosts (~25 or so) some of which use modperl, running on
a handful of 2-node tightly-coupled clusters with the content/scripts
sitting on NFS.

DNS for the virtualhost addresses points to a frontend cluster. I set up
extra aliases for my backend virtualhost addresses in the /etc/hosts files
on both the frontend and the backend servers.
dns:         www.glurp.com -> my.frontend.address
/etc/hosts:  glurp1        -> my.backend1.address
/etc/hosts:  glurp2        -> my.backend2.address
...for all services

The virtualhosts on the backend respond to the aliases in the /etc/hosts
file and serve dynamic content.

frontend writes /perl/ and /cgi-bin/ requests to a
random-selection RewriteMap of the backend servers for that service.

also at the frontend I took mod_proxy_add_forward.c and added another
header. My module now adds
X-Forwarded-For: remote.address    # remote address of client
X-Host: www.glurp.com              # real virtualhost address

The reason I used the X-Host header was to avoid
missing-trailing-slash requests coming back to the client with the wrong
(/etc/hosts aliased) virtualhost in the Location: response header.

I have a mod_perl handler at the backend which intercepts 301 Moved
Permanently requests which are usually thrown by missing-trailing-slash
requests and rewrites the Location response header using the X-Host
request header.

I don't know whether there's a nice way to do this but it works relatively
well.

===

To: Roger Pettett <rmp@sanger.ac.uk>
From: lesmikesell@attbi.com
Subject: Re: how to make mod_perl actually run fast
Date: Wed, 05 Dec 2001 14:15:22 +0000

>My module now adds
> X-Forwarded-For: remote.address    # remote address of 
client
> X-Host: www.glurp.com              # real virtualhost 
address
> 
> The reason I used the X-Host header was to avoid
> missing-trailing-slash requests coming back to the 
client with the wrong
> (/etc/hosts aliased) virtualhost in the Location: 
response header.

Note that Apache will fix the redirects for you if you
use the ProxyPassReverse directive regardless of whether
the proxy action was done from a ProxyPass or a
RewriteRule.  You just need a ProxyPassReverse entry
to match any of the targets that the rewrite can
generate.

===

To: lesmikesell@attbi.com
From: Roger Pettett <rmp@sanger.ac.uk>
Subject: Re: how to make mod_perl actually run fast
Date: Wed, 5 Dec 2001 14:27:55 +0000 (GMT)

I never managed to get ProxyPass & ProxyPassReverse to work properly
with farms of machines at the backend. :P

===

To: "Tyler 'Crackerjack' MacDonald" <tyler@yi.org>
From: "Perrin Harkins" <perrin@elem.com>
Subject: Re: how to make mod_perl actually run fast
Date: Wed, 5 Dec 2001 11:51:40 -0500

> It uses wildcard DNS and some other goodies to extend the
> mod_perl-server-via-proxy-from-static-server setup

Why not just use name-based virtual hosts for the backend and avoid all the
monkeying with DNS?

===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu