Maximum number of backends to try

Maxim Dounin mdounin at mdounin.ru
Tue Apr 6 12:25:14 MSD 2010


Hello!

On Mon, Apr 05, 2010 at 09:46:52PM -0400, bryndole wrote:

> The only such patch I could find was this:  
> http://openhack.ru/nginx-patched/
> 
> Which only works with the memcached_gzip plugin of which it is a 
> part. 

For me, 1st google result points to author's site (catap.ru) with 
the patch posted alone.

http://www.google.com/search?hl=en&q=upstream_count_limit
http://catap.ru/patches/nginx/ngx_http_upstream_count_limit-0.3.patch

Your google may vary though.

> I too would find this feature extremely helpful. Preventing the 
> situation where some request takes just a bit too long and times 
> out on server or generates the "wrong" type of error and nginx 
> tries upstream server after upstream server, without bound.
> 
> Any other suggestions? Is anyone working on a simpler patch?

Usually people just disable proxy_next_upstream (or limit it to 
something like "error") and use error_page based fallback instead.  
E.g.

    upstream backend {
        # many servers here
    }

    location / {
        proxy_pass http://backend;
        error_page 502 504 = @fallback;
    }

    location @fallback {
        proxy_pass http://backend;
    }

Maxim Dounin



More information about the nginx mailing list