I am thinking of programming a tcp server based on epoll
.
To achieve the best performance i want to implement multi core support too. But during my researches the following question came up:
Is it faster to call two epoll_wait()
-Calls from two different threads, each observing their own file descriptors on a dual core? Or is this as fast as calling just one single epoll_wait()
which observes all file descriptors?
Since the Kernel observes the file descriptors, i think it doens't matter how much threads i use on user space calling epoll_wait()
?
You can even call epoll_wait concurrently on multiple threads for the same epoll_fd as long as you use edge-triggered (EPOLLET) mode (and be careful about synchronisation). Using that approach you can get real performance benefits on multi-core machines compared to a single-threaded epoll event loop.
I have actually done performance measurements some time ago, see my blog postings for the results:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With