Interesting question. My first thought is: What's the big deal about 200 processes or threads? That would almost certainly be the easiest solution.

Assuming there's some good reason why that won't work, what you would need to be able to do is asynchronous database operations. Either a way to get a callback or a signal when results are ready, an implementation that guaranteed that some filehandle would be selectable only when there's results to read, or at least something you could poll with. You could look at your database's driver options to see if this is possible; if only the C version of the driver supports it, you could use Inline::C to talk to it.

Another option would be to proxy the results through something that would send you some kind of notification, or only make a filehandle selectable when results were ready. You could use some kind of RPC interface, like SOAP, or extend something like DBD::pNet to give it these capabilities.

But those are much harder than managing 200 threads or processes. :-)


In reply to Re: a IO:SELECT problem by sgifford
in thread a IO:SELECT problem by ablmf

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.