Fair Proxy Balancer

Grzegorz Nosek grzegorz.nosek at gmail.com
Mon May 5 23:26:35 MSD 2008

On Mon, May 05, 2008 at 06:21:49PM +0200, Matt Conway wrote:
> Grzegorz Nosek wrote:
> >
> > Please give the module a try and report any issues you might find.
> This module works great, thanks for releasing it.  While validating its 
> behavior, I noticed a few gotchas that I wasn't expecting, but I'm not 
> sure if there is anything upstream_fair can do about it:

I'm glad you like it :)

> 1) If a client performs a request which is long running, and then gets 
> fed up with waiting and closes the connection, upstream_fair marks the 
> backend process as idle even though it is still servicing the request - 
> I guess it is monitoring the front side of the connection rather than 
> the back side...?
> 2) If I have a long running request active on a mongrel, and nginx times 
> it out (proxy_read_timeout defaults to 60s), the request is still 
> running on the mongrel, but upstream_fair marks it as idle.

upstream_fair doesn't monitor anything by itself, it's told by the nginx
core when a request is started and when it ends. So unfortunately I cannot
do much about the issues you mention.

Igor, off the top of your head, do you know what status is passed to the
->free callback when a request times out? I could use it to penalise that
backend somehow.

Anyway, when nginx closes the backend connection, there's no way to know
what the backend is doing so it would be guessing at best (the backend
may finish half a second later or stay busy forever, we'll never know).

> These gotchas can both cause upstream_fair to schedule requests on 
> mongrels that are not actually idle when there are other idle ones 
> waiting

Since commit 4329e708 (Feb 2008) the round-robin mechanism should work
so this effect should be reduced to perform at least no worse than the
default round-robin balancer.

Best regards,
 Grzegorz Nosek

More information about the nginx mailing list