On Fri, Apr 21, 2006 at 09:35:01AM -0700, Hariram wrote:

> We are building a Server Application that needs to handle thousands of TCP
> connections. The usual procedure is to open up a socket for each TCP
> connection and then construct a read-file-descriptor list and pass it to
> select(). When select() returns, check for each file descriptor whether it
> is set in the read-file-descriptor-list. Walking through the list of
> thousand descriptors to see whether it is ready for read is CPU-consuming.

RTFM on poll(7d) and use that instead of select(3C).

The poll(7d) interfaces don't return a bit vector equivalently sized to your
file descriptor set.  Instead, it returns only descriptors with actual data
or other actions on them.  This lowers your overhead substantially.

Just make sure you remove descriptors from poll(7d)'s list when you close
them.  It's all there in the man page.

Dan
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to