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've spent most of my career working with or at startups. I'm currently the Director of Product @ Ockam where I'm helping developers build applications and systems that are secure-by-design. It's time we started securely connecting apps, not networks.

Previously I led the Terraform product team @ HashiCorp, where we launched Terraform Cloud and set the stage for a successful IPO. Prior to that I was part of the Startup Team @ AWS, and earlier still an early employee @ Heroku. I've also invested in a couple of dozen early stage startups.