Maxim Dounin
February 03, 2020 08:06AM
Hello!

On Sat, Feb 01, 2020 at 11:48:00AM -0800, Ian Morris Nieves wrote:

> Here is the setup:
> - I am running nginx in a single docker container and it has an
> upstream to a docker service which is composed of 3 docker
> containers (which happens to be php-fpm)
> - the service is configured to _not_ expose a single virtual ip
> address (vip), instead the service exposes the ip addresses of
> all 3 containers through docker’s built-in DNS. When this DNS
> is asked for the IP address of the service it will respond with
> a list of 3 IP address but the list will rotate in round-robin
> fashion each time a lookup is performed. Thus the first IP in
> the list will not be the same for any 2 consecutive lookups.
>
> My first question is:
> Is it the correct behavior that consistent hashing depends on
> the order of IP addresses in the DNS query response? I can
> imagine arguments either way, and it is possible that this
> critical detail is outside the scope of consistent hashing. I
> will also forward this question to the author of Ketama.

Consistent hashing uses the _name_ as written in the
configuration, not the IP addresses the name resolves to.

If a name resolves to multiple IP addresses, these addresses are
considered equal and requests are distributed between them using
round-robin balancing.

That is, to balance multiple servers (containers) using consistent
hashing, you have to configure an upstream block with multiple
"server" directives in it.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

upstream hash consistent seems to depend on order of DNS entries

Ian Morris Nieves February 01, 2020 02:50PM

Re: upstream hash consistent seems to depend on order of DNS entries

Maxim Dounin February 03, 2020 08:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 83
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready