[Mongrel] Why Mongrel with NginX

ryah dahl ry at tinyclouds.org
Sun Aug 10 08:47:18 EDT 2008


Hi John

On Fri, Aug 8, 2008 at 6:35 PM, John Hancock <lists at ruby-forum.com> wrote:
> Hi, I'm a newbie to Ruby. I'm installing an small server (256MB RAM)
> with NginX, Neko, Perl, PHP4, PHP5, Ruby & MySQL. It's easy Perl, Neko &
> PHP with FastCGI but why to use a mongrel cluster?

The only conceptual difference is the protocol being used between the
reverse-proxy (nginx in this case) and the application servers.
FastCGI is a protocol for reverse-proxies to speak to application
servers.  FastCGI is strange because it carries HTTP but is not HTTP.
With a Mongrel-style setup your application servers speak to the
reverse-proxy via HTTP.

FastCGI has a slight advantage over HTTP in that it's easier to parser
and more space-efficient on the line. However it adds an extra layer
of complexity - an extra protocol. You can't, for example, use CURL to
access a FastCGI application server.

The structure is the same though - a load balancer reverse proxy
process (nginx) and many application server processes (mongrel or
FastCGI instances). The load balancer distributes requests to the app
servers - gets a responses and sends them back to the clients.

Mongrel has worked better for many of us - not because of the protocol
difference - because it handles requests better. Ruby-FastCGI is also
a web server and has request handling logic - it just speaks FastCGI
instead of HTTP.

Someone could develop a better Ruby-FastCGI binding which understood
FastCGI but handled connections from the reverse-proxy better - but
that hasn't been done yet. And IMO it is a bit pointless - there need
not be a special protocol just for communication between load
balancers and app servers.


ry


More information about the Mongrel-users mailing list