Advanced Rails - Building Industrial-Strength Web Apps in Record Time

(Tuis.) #1

318 | Chapter 10: Large Projects


Apache (http://httpd.apache.org)
Of these servers, Apache is definitely the heaviest. Administrators who have a
choice usually select one of the lighter options. But Apache has some advan-
tages: it is well-known and relatively easy to configure, it is very flexible, and it
integrates well with its environment.
If you have a choice, use Apache 2.1 or higher, as it supportsmodproxy
balancer. Otherwise, you will need to proxy to a balancer such as pen or pound
in order to load balance between application servers.
Apache can actually directly serve Rails applications over FastCGI, using mod_
fastcgi and the Rails FastCGI dispatcher. However, this approach has mostly
been superseded by the reverse-proxy/Mongrel method for new deployments.


Lighttpd (http://www.lighttpd.net)
Lighttpd (usually just pronounced “lighty”) is a powerful, light web server. It
supports reverse proxying and load balancing with themod_proxymodule. It is
one of the preferred front end servers today.
Like Apache, lighttpd can directly serve Rails with FastCGI. This is still not rec-
ommended, as the Mongrel approach is more robust and scalable.


Pen (http://siag.nu/pen/)
Pen is a standalone proxy balancer. It does not serve static files; it only proxies to
a list of servers and balances between them. Pen has SSL-wrapping support.
If high availability is needed, Pen can be clustered using the VRRP protocol for
failover.


Pound (http://www.apsis.ch/pound/)
Pound is another reverse proxy balancer. Like Pen, it can proxy, balance
between servers, and unwrap SSL. It is also not a web server, so you may have to
set up a static file server.
However, Pound has some X-Forwarded-For problems when being used as a
reverse proxy between Apache and Mongrel,*so you should consider Pen instead
for this configuration.


nginx (http://nginx.net)
One of the newest but most promising contenders is nginx (“engine X”). Like
Apache and lighttpd, nginx is a web server with comprehensive load balancing,
rewrite, and proxy features. While the featureset is comparable to Apache, the per-
formance characteristics and memory footprint are more like lighttpd. At the
moment, nginx seems to be the best front end for Rails applications.


*http://blog.codahale.com/2006/11/07/pound-vs-pen-because-you-need-a-load-balancing-proxy/

Free download pdf