Perl Parallel Processing for data collection 2

Figured I’d update and say that I solved the issue with threading. (Thanks Steve). The agent.pl script is now using the Proc::Queue module to automatically manage the number of spawned processes via forking. Here’s the run down.

use Proc::Queue;
Proc::Queue::size(10); # changing limit to 10 concurrent processes
Proc::Queue::trace(0); # trace mode off
Proc::Queue::debug(0); # debug is off
Proc::Queue::delay(0.5); # set 500 miliseconds as minimum
# delay between fork calls

…..

$count = @Array;
# loop throuhg the results and spawn processes with Proc::Queue
while($i < $count) {
my $f=fork;
if(defined ($f) and $f==0) {
thread_exec(); #call the poller kickoff function
exit(0)
}
$i++;
}

Leave a Reply

*