Subject: Re: select() question
To: Erik Huizing <>
From: glen mccready <>
List: tech-net
Date: 08/15/2001 12:51:18
Erik wrote:
>Quick question about select:
>  is it better to use select on a large (possibly >5,000) number of
>sockets, or to split the job up amount, say, 10 or 20 threads, where each
>thread has a more manageable list. If it makes any difference, each socket
>sends something ata fairly low rate (>10 seconds between transmissions)
>and the packets are small (<100 bytes).

can you predict when a socket will be going ready?  if so, bucket your
sockets into activity groups and select/poll on the smaller buckets
based on when you believe they'll go ready next.  you'll drive latency
up a bit but given the spacing of events it probably won't matter to you.
(this may be required based on FD_SETSIZE, anyway)

otherwise, as perry says, kqueue or something like /dev/poll where
you can register for persistent event notification is really what you