Glenn Gillen

Engine Yard Bounty Pays Off

Engine Yard, the current big daddy of rails hosting, decided to put a bounty out to solve a problem all the newly converted rails/nginx users would have to some degree but have previously been ignoring. The load balancer in nginx works in a round robin fashion meaning that any long running request has the potential to cause another user to queue behind it, rather than getting served by one of the free and waiting mongrels. Well wait no more!

Take a look at Ezra's blog for the most definitive run down on how to get it working for you, but the digest version goes a little something like this.

Download the optional module tarball from nginx fair proxy balancer and then do the following:

cd nginx.git
./configure—with-http_ssl_module
make
sudo make install

Now that you've compiled with the new module all that is left to update your upstream nginx.conf to include the fair directive:

upstream mongrel {
fair;
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}

Glenn Gillen

I'm an advisor to, and investor in, early-stage tech startups. Beyond that I'm an incredibly fortunate husband and father. Working on a developer-facing tool or service? Thinking about starting one? Email me and let me know or come to one of our days to help make it a reality.