Nginx session-stickiness

Dave Cheney dave at cheney.net
Mon Apr 7 09:13:24 MSD 2008


I've just set the fail timout for connection to 1 second. That  
generally avoids sitting in connect() to long for a dead backend.

On 07/04/2008, at 2:42 PM, Rob Mueller wrote:
>
>> +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