How to pass sockets to different threads?by noslenj123 (Scribe)
|on Dec 30, 2003 at 22:49 UTC||Need Help??|
noslenj123 has asked for the wisdom of the Perl Monks concerning the following question:
I have been trying to work out a high connection perl server for a testing project at work. I have problems getting beyond 64 connections or about 110 (using threads).
I tried creating arrays of IO::Select objects which seemed to fall down just over 100 sockets. I tried using threads with a thread per socket which fell down around 110 sockets.
Recently I read something here that suggested that IO::Select can handle 64 sockets and that you can only have one IO::Select object per thread.
So I am trying to accept new sockets and push them onto a shared array or hash so that pre-started worker threads can lock that hash and suck the sockets out and handle them in it's own IO::Select. I have run into the dreaded "Invalid value for shared scalar" thingy. I also tried using Thread::Queue with no luck.
Does anyone have any wisdom on how to handle a large number of sockets (100-512) simultanieously? I am using ActivePerl 5.8.0 build 806 (I'll look at a newer version) but I can also run under Linux if that's preferred.
my $nuts = 'in pain';