Nginx session-stickiness

Rob Mueller robm at fastmail.fm
Mon Apr 7 08:42:39 MSD 2008


> +1, it is common for our app to have backends that can't be
> connect()ed temporarily during a roll or restart.

At the moment we do this by having a separate file included as:

  include /etc/nginx-servers.conf;

A separate process is kept running which every 10 seconds queries our DB for 
"up" servers and rebuilds the nginx-servers.conf file. If a server is marked 
as down, it adds a "down" suffix to the appropriate server, and then HUPs 
nginx.

Our code to do a rolling restart of the backends basically updates the DB to 
let it know the backend is down, waits 15 seconds, restarts the backend, 
then marks it as up again in the DB, waits 15 seconds, then moves to the 
next server.

This pretty much ensures that no clients see any downtime at all, though I 
think "keep alive" connections may still see a problem, haven't tested 
closely...

Rob






More information about the nginx mailing list