upstream+ip_hash: hash valid global?

Maxim Dounin mdounin at mdounin.ru
Mon Sep 30 15:06:36 UTC 2013


Hello!

On Mon, Sep 30, 2013 at 09:16:14AM -0400, revirii wrote:

> Hi,
> 
> thanks for your answer :-)
> 
> > It's an implementation detail.  As of now, two identical 
> > upstream{} blocks will map the same ip address to the same peer's 
> > number.  But it's not something guaranteed.
> 
> ok, this is the behaviour when the upstreams are identical, i.e. they have
> the same backends. That would be ok for me.
> 
> But what if the backends are not identical? My example was:
> 
> upstream one {
> server backendA;
> server backendB;
> server backendC;
> }
> 
> upstream two {
> server backendA;
> server backendD;
> server backendE;
> }
> 
> If a user sends a request - > upstream:one -> backendA and then makes a
> request where upstream:two is used, is he then sent to backendA as well? Ok,
> this would be nice to know, but it's not that important ;-)

As long as all servers configured map to the same number of 
peers (in most simple case - each "backendX" resolves to a single 
ip address) - such backends are identical for the above sentence, 
and the request will be sent to "backendA" in both cases.

But, again, this isn't something guaranteed.

-- 
Maxim Dounin
http://nginx.org/en/donation.html



More information about the nginx mailing list