wanted: ability to listen on existing socket/fd
benfleis opened this issue · comments
In order to implement zero-downtime process rollover, I would like to have to the ability to listen on an existing fd, a la server.listen({ fd: 0 })
API [1]. I have a WIP diff for node/js, which will shortly be added.
[1] https://nodejs.org/api/net.html#net_server_listen_handle_callback
Can you please lay out details on one or more use cases? I think I understand how you intend to use this, but I want to be sure.
The main use case is passing a listening fd from one server to another with a low amount of downtime.
You want to be able to start a new instance of a worker and only close the old listening socket once the new instance has listened. This is useful if your process takes seconds to start.
I get that @Raynos, but I still would like more clarity on an example of how this gets used in practice.
This is how I intend to actually use it. (crank might be replaced with a supervisord plugin module, but that has other risks.)
- supervisord spawns crank process
- crank maintains an open, listenable socket/fd on configured port
- crank spawns ringpop-app
On upgrade:
- untar new package
- signal to crank, which in turn
- spawns new ringpop-app with handoff FD, after which
- old ringpop-app is killed
Make sense?
Crank could be socketmaster (which is time based), or for nodejs, I already have a cluster-based approach to doing the same.