I'm implementing a socket server. All clients (up to 10k) are supposed to stay connected.
Here's my current design:
- The main thread creates an event loop (use epoll by default) and a watcher for accepting clients.
- The accept callback
- Accept fd and set it to non-blocking mode.
- Add watcher for the fd to monitor read events.
- The read callback
- Read data and add a task to thread pool to send response.
Is it OK to move read part to thread pool, or any other better idea? Thanks.