3 ms·
I don't feel like this was given enough time: > One option is to use SO_REUSEPORT and create multiple listen sockets sharing the same port number. This approac
by bluejekyll 10y ago
I don't feel like this was given enough time:
> One option is to use SO_REUSEPORT and create multiple listen sockets sharing the same port number. This approach has problems though - when one of the file descriptors is closed, the sockets already waiting in the accept queue will be dropped
Yes, it's a problem if you use it across processes... but if you have a single long lived process with each thread listening on a separate queue, isn't that the simplest solution?
- richardwhiuk 10y agoThat process isn't allowed to fork, I assume, which is problematic.
- bluejekyll 10y agoI'm not proposing a fork either. Each thread would open a separate socket with the SO_REUSEPORT set. The kernel would then have a separate queue per socket. Please correct me if I'm wrong.
- richardwhiuk 10y agoI'm saying that none of those threads can start any programs. That may or not be required by your use-case, but it's certainly a disadvantage.