libuv: multiple event loops for TCP connections?

Viewed 45

I have been looking at libuv, and learned that due to its none-blocking style, it can handle lots of TCP connections simultaneously on just one thread. On a multi-core machine, it follows that it could handle even more connections, so would like to investigate this.

I have read quite a lot of material, but have not been able to find an example of using multiple event loops, each one within its own thread, for handling TCP connections. The closest I have come is the multi-echo-server example, but this uses multiple processes, not threads.

  1. Can anyone point me at an example of using multiple event loops, each in their own thread, for TCP connections, please?

  2. Would using multiple processes (like nginx does) - as opposed to multiple threads - be generally a better idea? (Perhaps this is why I cannot find an example of what I want?)

0 Answers
Related