Welcome! Log In Create A New Profile

Advanced

Re: session persistance with IP hash

Robert Paprocki
July 27, 2016 09:46PM
>
>
> I'm not as concerned with what server its routed to as much as I am
> concerned with the client session "sticking" to the server it was routed
> to. And I really do not know enough about how to use cookie based hashing.
> In order to have cookie bashed hashing would the cookie need to be common
> among all pages at the target URL in order to stick the session to a
> particular server for the duration of that session?
>

Assuming you're using a cookie to track the session, the cookie shouldn't
change depending on what URI the user is accessing.


> (And, I assume cookie bashed hashing is not like ip hash in that you are
> only stuck to a particular server for the duration of that browser session?)
>

Depends on how long the cookie lives on the browser. If the cookie never
changes and doesn't expire when the browser closes, the backend wouldn't
change (again, assuming nothing changed about the backend servers).

It doesn't matter what is used to build the hash key - cookie, ip,
whatever. As long as that value doesn't change, and nothing changes about
your backends, the client will hit the same backend every time. Guaranteed.


> Also, what is the logic behind "round-robin" or is that the same as
> ip_hash? For instance, If I have a client at 192.168.100.10 that's assigned
> to backend 3, then, 100 more clients come along on the same subnet, they
> will all land on backend 3. Next client 192.168.200.10 comes along, what
> determines whether it lands on backend1 or backend2? Or, is there a chance
> it could also land on backend3?
>

Round robin means that each backend will be used in turn, regardless of the
client. For example, if you have 3 backends:

request 1 -> backend1
request 2 -> backend2
request 3 -> backend3
request 4 -> backend1
request 5 -> backend2

This goes on forever, regardless of the client IP. (Of course, this is
relative if you are using server weights - see the example at
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream for a
round robin example with weights). If you want session persistence, then
round robin balancing is not for you.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

session persistance with IP hash

Brian Pugh July 27, 2016 04:22PM

Re: session persistance with IP hash

Robert Paprocki July 27, 2016 04:36PM

Re: session persistance with IP hash

Reinis Rozitis July 27, 2016 04:46PM

Re: session persistance with IP hash

Brian Pugh July 27, 2016 04:56PM

Re: session persistance with IP hash

Reinis Rozitis July 27, 2016 06:04PM

Re: session persistance with IP hash

Brian Pugh July 27, 2016 09:24PM

Re: session persistance with IP hash

Robert Paprocki July 27, 2016 09:46PM

Re: session persistance with IP hash

Brian Pugh July 28, 2016 10:34AM

Re: session persistance with IP hash

Robert Paprocki July 28, 2016 12:08PM

Re: session persistance with IP hash

Brian Pugh July 28, 2016 12:42PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 191
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