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';


In reply to How to pass sockets to different threads? by noslenj123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.