twitter/twemproxy — pull request #257 by idning (2014-09-04 12:58:51+00:00)
Title: hot-reload

how it works:

1. when we receive USR1 signale, we will fork and exec with new binary and new config.
2. the new process will inherited all listen-socket from the old process, including:
- stat socket
- listen socket for each pool
3. after the new process is already running, the old process will close all listen socket.
and wait for 3 seconds (for those who has already connected with old process)
3 seconds later, it close all client socket and shut down

(however, the keep-alive connectin will be closed, we can not wait forever)

TODO:

- make it work for ``unix domain socket``
- need test on nc_kqueue

test cases:

https://github.com/idning/test-twemproxy/blob/master/test_system/test_reload.py