treasure-data / serverengine

A framework to implement robust multiprocess servers like Unicorn
Apache License 2.0
759 stars 86 forks source link

socket_manager: add feature to take over another server #146

Closed daipom closed 3 weeks ago

daipom commented 2 months ago

Another process can take over UDP/TCP sockets without downtime.

server = ServerEngine::SocketManager::Server.take_over_another_server(path)

This starts a new server that has all UDP/TCP sockets of the existing server. It receives the sockets from the existing server and stops it after starts a new server.

This may not be the primary use case assumed by ServerEngine, but we need this feature to replace both the server and the workers with a new process without downtime. Currently, ServerEngine does not provide this feature for network servers.

At the moment, I assume that the application side uses this feature ad hoc, but, in the future, this could be used to support live reload for entire network servers.

daipom commented 2 months ago

TODO add tests.

ashie commented 2 months ago

I've rebased this on top of current master branch.

daipom commented 3 weeks ago

Sorry, I have made a new PR for this to change the branch.