Fair Proxy Balancer

Ezra Zygmuntowicz ezmobius at gmail.com
Fri Nov 23 03:05:53 MSK 2007

On Nov 22, 2007, at 2:16 PM, Janko Hauser wrote:

> Am 22.11.2007 um 22:38 schrieb Adam Zell:
>> Hello,
>> In case people haven't seen it:
>>  http://www.brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel
>> "So EngineYard.com put out a bounty on getting a fair proxy balancer
>> that would keep track of when a mongrel is busy and not send requests
>> to it until it has finished and is ready to take requests. This means
>> that now we can effectively queue inside nginx very efficiently and
>> only send requests to non busy mongrels. Thereby avoiding the waiting
>> in the wrong line for service problem described above."
>> I am guessing that the strategy is at the network level, so it should
>> work with non-mongrel back-ends.
> Great news, this will be a huge step also for the case of Zope zeo- 
> deployments. One question, how is the busy state determined? In case  
> of zeo each backend client can take some defined number of requests  
> in parallel, how is such a case handled? (Not knowing mongrels, are  
> they taking only one request each?)
> With regards,
> __Janko Hauser

	Mongrels are single threaded when running rails so this fair balancer  
tries to only send requests to mongrels that are not currently serving  
requests. But once you surpass all the backends being busy it uses  
some nice weighting algorithms to try and still serve requests to the  
least congested backends. there is some nice rbtree and scheduling/ 
weighting code  in there now as well. The module works with 0.5.x and  
0.6.x and once it is completely stable we plan to offer it to Igor to  
see if he wants to include it in the main distro.

	There was just a new push of code so if anyone wants to play you can  
go here:


	And click on snapshot to grab the latest snapshot.  Please play  with  
this and report any weird results or problems you experience so we can  
improve the module.

	I am already using this in a number of production sites ans it works  
great, a huge improvement for rails apps running on nginx + mongrel.  
Of course this is still alpha stuff so don't put it into mission  
critical production setups yet> But in general and I very happy with  
the stability and performance of this new module.

	This new module will actually work for any http backends and is not  
directly tied to mongrel at all so this is probably good for other non  
rails backends as well. Please test your setups with this module.

	Grezegorz has done an awesome job on this and should be commended.

- Ezra
- EngineYard.com

More information about the nginx mailing list