Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
The code linked in the article is quite explanatory - you have not a single listening socket, but per-core each.
it is not sufficient: a listen socket has its own queue of new TCP connections (that were already handshaked by the kernel), so dropping the listen socket drops the queue. The right way is to start the new server, transfer the listen socket from the old server to the new one with SCM_RIGHTS, then start accepting again from the new instance. That's how it is done in the sozu HTTP proxy (which also uses SO_REUSEPORT to launch multiple work processes each with their own listeners, to improve performance and isolate failure)
What you really need is a facility to pass down a socket from a process to another, like facebook's grace https://github.com/facebookarchive/grace (in go). This way you can guarantee you don't lose a single connection.
Related posts
- Erlang: More Optimizations in the Compiler and JIT
- Open Source HTTP Reverse Proxy Built in Rust for Immutable Infrastructures
- Do most people just restart their Rust web servers once every three months?
- Any thoughts about Clever Cloud? (Has native rust support.)
- Force all rust application traffic to pass from proxy.