Welcome! Log In Create A New Profile

Advanced

Re: Using round robin for load balancing if hash key is empty

Niklas Keller
May 23, 2019 01:56PM
> > I'd like to propose falling back to round robin if the hash key is
> > empty. This allows using hashed cookie values for sticky sessions
> > while using round robin for all requests that do not carry any session
> > information and thus do not need the stickiness. While Nginx Plus
> > allows to use the learning mode, this patch avoids the need for
> > synchronization between multiple instances.
> >
>
> Can you please elaborate on balancing/sticky scheme you are using?
>
> Say, first request without cookie is balanced by round-robin, arrives
> at some backend, which responds with cookie.
> Next time, the request with cookie is balanced by hash algorithm,
> and the result can be easily another backend. How do you deal with this?

Very few requests depend on the stickiness in our application. The
main use case is showing success messages once after a form is
submitted.

In these cases, the usual flow is:
- GET /form → Server assigns cookie
- POST /form → Client sends cookie, a different server might be
selected, but doesn't matter
- GET /form?_key=abc → Client sends cookie again, success message is
shown and removed from the session, same server as in the previous
request is selected

For cookie-less clients, e.g. crawlers and webhooks, the stickiness
doesn't matter at all, so these shouldn't be sticky to avoid peaks on
single backend nodes.

@Roman: Patch looks good to me, thanks!

Regards,
Niklas
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Using round robin for load balancing if hash key is empty

Niklas Keller 382 May 22, 2019 04:02PM

Re: Using round robin for load balancing if hash key is empty

Roman Arutyunyan 157 May 23, 2019 09:50AM

Re: Using round robin for load balancing if hash key is empty

Maxim Dounin 129 May 27, 2019 12:58PM

Re: Using round robin for load balancing if hash key is empty

Vladimir Homutov 147 May 23, 2019 11:22AM

Re: Using round robin for load balancing if hash key is empty

Niklas Keller 193 May 23, 2019 01:56PM

Re: Using round robin for load balancing if hash key is empty

Roman Arutyunyan 160 May 27, 2019 01:00PM

Re: Using round robin for load balancing if hash key is empty

Niklas Keller 153 May 27, 2019 05:02PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready