3 ms·
> If you think select isn't broken, show me a small server written using it that can handle more than 1024 concurrent clients. Divide your FDs into groups of 1
by pcwalton 10y ago
> If you think select isn't broken, show me a small server written using it that can handle more than 1024 concurrent clients.
Divide your FDs into groups of 1024 each. Put each group in a different worker thread, each connected to the main thread with a Unix socket. Select over the group in each worker thread; when a socket wakes up, notify the main thread. Select over the worker connections in the main thread.
You laugh, but it's a documented approach on Windows [1].
[1]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...
- qwertyuiop924 10y agoThat actually doesn't sound like the worst solution in the world. Not really a good one, either, but not as awful as you make it out to be. But I don't touch the kernel, so I could be wrong there.