Efficient Multicore Networking
I am working on a design for some kind of a firewall that needs to handle heavy traffic. In my application I have a few raw socket file descriptors that I need to receive from. It is important to me that to design my application to be efficient and scalable on multicore architecture.
In order to do so I thought about creating receiving threads as many as the number of cores. Each thread will call select() on ALL sockets FDs. I am not sure this is a safe design. I am also not sure what will happen in case only one socket will be contended, will it scale?
I guess I can use a single thread that calls select(), put the received packets in a queue, and let processing threads to process it. I do prefer the first design because I don't want to pay the queue and the context switch overheads.
Is the design using select() in multiple threads is a correct design?
Thank you for your help,