Ray Smith has asked for the wisdom of the Perl Monks concerning the following question:
Another optimization possibility$SIG{INTERUPT_ON_PENDING_SOCKET_IO} = \&ckSockets;
Even though we may have 1000+ open sockets the activity at any one time is sparse. I've been speculating about going back to the bit vector version of select and looking at the 1000+ bit length vector 32 at a time. I'm not optimistic about this approach. For all I know, the implementer of IO::Select may already do this. Highly simplified version of my current code
Looking at the top of profiled run below we see that the time appears dominated by calls to the socket testing:use IO::Select; ... # Check for and process any pending socket input # avoid steping on toes by keeping running list of ready # sockets and process it untill empty sub ckSockets { # Returns: # of ready so we can tell activit +y ... my @breadys = $io_select_obj->can_read(0); foreach my $fd_key (@breadys) { ...read and process data from this socket... }
Update: Updated to correct spelling on IO::Select, add '0' to can_read to reflect actual code.[root@ibm-blade-blade0 testbuddy]# time dprofpp Total Elapsed Time = 1790.060 Seconds User+System Time = 1315.990 Seconds Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 55.9 736.8 753.00 317833 0.0002 0.0002 IO::Select::can_read 9.05 119.1 256.27 363021 0.0000 0.0001 BuddyUsers::log 5.25 69.14 137.12 350999 0.0000 0.0000 tsprint::ts 5.17 67.97 67.979 350999 0.0000 0.0000 POSIX::strftime
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket IO with large (>1000) numbers of open sockets
by Util (Priest) on Jun 10, 2007 at 02:50 UTC | |
|
Re: Socket IO with large (>1000) numbers of open sockets
by BrowserUk (Patriarch) on Jun 10, 2007 at 08:35 UTC | |
by Ray Smith (Beadle) on Jun 11, 2007 at 16:50 UTC | |
by BrowserUk (Patriarch) on Jun 11, 2007 at 17:33 UTC | |
|
Re: Socket IO with large (>1000) numbers of open sockets
by dmitri (Priest) on Jun 10, 2007 at 20:32 UTC |