Hi all!


BACKGROUND ON PROBLEM / PAST ATTEMPTS:
I've been trying to do some inter process communication with perl on win32 to no avail. This is for a bot that is going to do indexing of web sites for a search engine. The current architecture is for ~805 concurrent processes (23 perl interpreters with 35 forked processes each) per box. This seems to be working without much of a dent to the resources, the only problem is doing the actual IPC. I've tried tcpip with a server process per each process but it isn't fast enough (can't leave the socket open or we over run the io::select limit per process), Win32::Pipe worked great until the HUGE memmory hole was found that filled up the 8GB commit charge cache secretly and brought the box down to it's knees.

CURRENT ATTEMPT / PROBLEM:
Now I'm trying to use perl's native "pipe" function which is supported in win32 perl. I can't seem to get it to fork off more than 2 processes without closing down the pipes, it seems to "block" after 2 processes. Any tips on how to get this to work / a better option?

Thanks for all your help in advance!

-Chris


TEST SCRIPT TO ILLUSTRATE PROBLEM:
# Example of pipe problem # Useage: perl pipetest.pl 2 # $ARV[0] represents how many processes to fork off, run with 2 and it + will # send a line of text from the main process and print it to STDOUT pipe READ1, WRITE1; pipe READ2, WRITE2; pipe READ3, WRITE3; pipe READ4, WRITE4; pipe READ5, WRITE5; for(1..$ARGV[0]) { $forke++; my $pid; if($pid = fork) { # parent $| = 1; $SIG{CHLD} = 'IGNORE'; if ($forke == $ARGV[0]) {&server;} } else { $| = 1; # child die "cannot fork :$!" unless defined $pid; print "Forked $forke\n"; for (;;) { $read_pipe="READ$forke"; while (<$read_pipe>) {print "Child $forke: parent said \"$_\"\n"}; } } } sub server { $t=0; for (1..5) {$t++; $write_pipe="WRITE$t"; select($write_pipe); $|=1; print "TESTING 1 2 3\n"; } }

In reply to Pipe w/ fork on Win32 by Canadian_Chris

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.