Engine Yard Bounty Pays Off

Nov 21, 2007

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;
}
Hi, I'm Glenn! 👋 I'm currently Director of Product @ HashiCorp, and we're hiring! If you'd like to come and work with me and help make Terraform Cloud even more amazing we have multiple positions opening in Product ManagementDesign, and Engineering & Engineering Management across a range of levels (i.e., junior through to senior). Please send in an application ASAP so we can get in touch.