Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
HEY! Got the server working by putting some of Thread::Queue into my code, and now it seems to be running like a champ. If you'd like to see the code let me know, but I'm guessing you have a fair idea of how its working. Ran 200k commands in 2 hours without a hiccup.

Cool. (Yes. I would really like to see the code. You have my email id.)

And that is really interesting that threads got messed up. I'll definitely try downgrading perl and testing it out but as it is no longer a time critical thing, and more a matter of interest, I probably wont get to it until next week.

I took your latest code -- stripped out the defensive stuff out of rxd.pl:

# if( threads::list( threads::running ) >= 100 ) { # sendResponse("Session rejected. Too many sessions currently r +unning.\n", 101, $client); #just decided 101 should be the retry retu +rn code, no reason really # # tprint( "Session request by " . $client->sockhost() . " rej +ected" ); #disabled because it was flodding the log # $client->shutdown(2); # $client->close; # }else

Tweaked the client (rx,pl) to run many commands in loop and do so from multiple threads:

our $T //= 1000; our $R //= 1000; my @threads; for my $t ( 0 .. $T ){ push @threads, async { for my $r ( 1 .. $R ) { print "Client:$t sending command: $r\n"; my $server; my $rc; my $response; while(1){ $server = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $address, PeerPort => $port, ); unless (defined($server)){print "Unable to connect to +RXD; [$! / $^E\n";} $server->autoflush(1); sendCommand( $server ); ($response, $rc) = receiveResponse( $server ); if($rc == 101){ shutdown($server, 2); close $server; my $random = 1 + rand(10); # select(undef, undef, undef, $random); next; } else{last;} } debug("Closing connection"); shutdown($server, 2); close $server; }; }; } $_->join for @threads;

With 5.16.1, this falls in a heap with 1 thread after just a few seconds. The same "invalid handle" stuff as you've been seeing.

With 5.10.1, I ran the above with those numbers -- 1000 concurrent clients, each running 1000 commands (the simple dir /s) and it ran to completion (after 1,000,000 commands served :), without errors in a little over 1 1/2 hours. And that's with 3 cores running the server and 1 core running the clients. Peak memory usage for the server was around 1.5 GB.

Again, I really cannot stress enough how thankful I am for all your help debugging. Could not have gotten this far without you.

YW. I learn almost as much from each of these real-world uses as the people I'm helping do.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


In reply to Re^15: PANIC: underlying join failed threded tcp server by BrowserUk
in thread PANIC: underlying join failed threded tcp server by rmahin

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (4)
    As of 2014-04-20 04:01 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (485 votes), past polls