session persistance with IP hash

Brian Pugh project722 at
Wed Jul 27 20:21:03 UTC 2016

Running nginx free version 1.10.1-1.el6.ngx.x86_64 on RHEL 6.7. In my conf
I am using

http {
    upstream backend {
        # Use ip hash for session persistance
        server backend1:80;
        server backend2:80;
        server backend3:80;


My understanding is that the ip_hash directive is responsible for session
persistence. My questions are:

1) How long does it last? For example, if I connect and my ip hash tells
nginx to connect to backend3, will my source IP be forever tied to backend

2) Is there another way to acheive session persistence other than ip hash
and other than purchasing plus edition?

3) Is there an ip hash "cache" or something I can clean out periodically to
force the source IP to get a new hash and therefore a chance to connect to
a different server?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list