Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: OT: Parallel::ForkManager and suitable load (Ubuntu)

by marioroy (Prior)
on Mar 12, 2024 at 17:17 UTC ( [id://11158207]=note: print w/replies, xml ) Need Help??


in reply to Re^3: OT: Parallel::ForkManager and suitable load (Ubuntu)
in thread OT: Parallel::ForkManager and suitable load (Ubuntu)

MCE::Hobo uses MCE::Shared for IPC. You may prefer MCE::Child to not involve a shared-manager process. MCE::Child uses MCE::Channel for IPC. MCE::Channel came long after making MCE::Hobo and thought to make something similar that works with Perl v5.8.1 and above.

use v5.10.1; use MCE::Child; MCE::Child->init( max_workers => 50, posix_exit => 1, on_finish => sub { my ($pid, $exit_code, $ident, $exit_signal, $error, $resp) = @ +_; print "child $pid completed: $ident => ", $resp->[0], "\n"; } ); foreach my $data ( 1..2000 ) { MCE::Child->create( $data, sub { MCE::Child->yield(0.008); # sleep 1; # simulate connection instantiation [ $data * 2 ]; }); } MCE::Child->wait_all;

Writing MCE::Child was helpful in improving MCE::Hobo and vice versa. Yeah, there are two similar modules. MCE::Child is mostly compatible with MCE::Hobo. MCE::Hobo is more compatible with threads, but requires Perl v5.10.1 minimally.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11158207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2025-02-09 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (96 votes). Check out past polls.