onebyone rolling restarts moving too quickly

Skip to first unread message

Apr 11, 2017, 5:36:25 PM4/11/17
to thin-ruby

We have a setup where nginx sits in front of 2 thin servers, and during deploys restarts the one on port 9000, then restarts the one on port 9001.  We are using the onebyone option and driving the deploy with capistrano.  It appears that what happens is thin stops the 9000 server, starts the 9000 server, and then as soon as it can get a socket moves on and takes down the 9001.  Unfortunately it seems like there is some gap in between being able to get a socket ( and being responsive as an app server (maybe this is the rails environment loading?).  This results in both of our servers being nonresponse at once and causes nginx to serve 502s for about 2-300ms during deploys.

Here is our server config:
chdir: /var/www/current
port: 9000
timeout: 30
log: log/thin.log
pid: tmp/pids/
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 60
user: www-data
group: www-data
daemonize: true
onebyone: true
servers: 2

1. Is there something obvious we are doing wrong?
2. Is there some way to add a few seconds pause before taking down the next server?
3. If we were able to find a more reliable way to determine if a rails server was responsive would you be interested in a patch?

Reply all
Reply to author
0 new messages