|
|
|
|
|
by zimbatm
4194 days ago
|
|
This is something the process manager should handle. With this approach each language and program has to implement the fd-passing and restart coordination. It also doesn't integrate really well with systemd/upstart because they want a stable pid. That's why I wrote socketmaster[1], it's simple enough that it doesn't need to change and it's the one handling the socket and passing it to your program. I haven't had to touch it for years now. For my current work I wrote crank[2], a refinement of that idea. It's a bit more complex but allows to coordinate restarts. It implements a subset of the systemd socket activation protocol conventions. All your program has to do is look for a LISTEN_FDS environment variable to find the bound file descriptor and send a "READY" message on the NOTIFY_FD file descriptor when it's ready to accept new connection. Only then will crank shutdown the old process. * [1]: https://github.com/zimbatm/socketmaster
* [2]: https://github.com/pusher/crank |
|
Edit: more concise explanation, in the context of SO_REUSEPORT: http://lwn.net/Articles/542718/