Achieving strong client -> upstrem_server affinity

Srirang Doddihal om.brahmana at
Fri Aug 31 07:57:46 UTC 2012


On Fri, Aug 31, 2012 at 2:52 AM, Alexandr Gomoliako <zzz at> wrote:
>> I am using ip_hash to make sure that a client will always be served by
>> the same upstream server. This is essential.
>> 1) Despite ip_hash being specified the request from a particular
>> client IP sometimes (close to 7% of requests) get routed to a second
>> upstream server
>> 2) Despute proxy_next_upstream off; some requests (about 5%) are tried
>> over multiple upstream servers.
>> how do I go about fixing these?
> With a little help from perl :)
> Check out this example:
> It decides which upstream to use by hashing $r->uri, but you can
> replace it with $r->remote_addr

Perl.. ouch.!!. :)

I was hoping it wouldn't come to that.

So does that mean ip_hash works on a best effort basis and doesn't
always ensure that requests from a particular remote_addr go the same
upstream server?

> _______________________________________________
> nginx mailing list
> nginx at

Srirang G Doddihal

The LIGHT shows the way.
The WISE see it.
The BRAVE walk it.
The PERSISTENT endure and complete it.

I want to do it all ALONE.

More information about the nginx mailing list