[Mongrel] apache -> pen -> mongrel cluster
coda.hale at gmail.com
Mon Nov 13 21:20:25 EST 2006
On 11/13/06, Mark Uhrmacher <mmmaui at gmail.com> wrote:
> Can someone explain to me the benefit of using Apache and Pen as opposed to
> either using apache as a load balancer or pen by itself?
I'm on the Apache 2.0 + Pen + Mongrel bandwagon, mainly because Debian
Sarge doesn't have Apache 2.2 yet, and I seriously don't feel like
trying to manage a mess of hand-compiled applications across a server
cluster. Instead, I watch the Debian Security RSS feed and run a
Capistrano task if I see anything I recognize.
The main benefit for running a proper web server like Apache up front
is that you can configure it with mod_rewrite to serve up static files
and only proxy dynamic requests. Mongrel is awesome, but Apache's much
better at serving static files. Also, Apache has mod_security,
well-developed SSL capabilities, and there's a wealth of information
available on configuration and management. I'd love to use Lighty, but
until it gets better proxying and rewrite modules (I heart
disable_web), I'm sticking with Apache.
Pound and Pen are very similar, and the main difference in when to use
them is on what side of the web server they go on. Pound works best in
front of web servers, mainly because you cannot disable the
X_FORWARDED_FOR header. If you use it behind Apache, then Rails all
requests to be requests from localhost, and so on an unhandled
exception Rails farts out a full debug message to all and sundry. Pen,
by default, doesn't add this header (optionally it can), and so it
makes for a wonderful intermediary between Apache and your Mongrel
cluster. I had to switch from Pound to Pen because of the local
request problem, and Pen's handled all of the load testing just fine.
It even allows you to specify a maximum concurrent connection limit
for each server, so you don't get a bunch of requests queued up in
Mongrel and mess your load balancing up.
The one down side to Pen is that the version in Debian stable doesn't
read from any kind of config file, nor does it come with a service
script. So I had to write my own. You can get it at
Right now Apache 2.0 + Pen + Mongrel is working like a charm, and I
would only consider switching for four reasons:
1. Mongrel becomes stupid-fast with static files.
2. Apache 2.2 makes it into Debian Unstable.
3. Lighty's proxy and rewrite module stop sucking and it makes it into
4. I get a hardware load balancer and a couple of Lighty-based asset hosts.
Until then, I'm doin' fine.
More information about the Mongrel-users