I have tried with Perl fork manager and DBI . But i got the error DBD::mysql::st execute failed: Lost connection to MySQL server during query .
Here the sample code: I want make query between low to high value (i have spitted int 10k records)
use Parallel::ForkManager;
my $pm = new Parallel::ForkManager(50);
my $db = krish::DB->new or die $!; # its has all connection details
while ( $low < $high ) {
# Some value manipulation
my $pid = $pm->start and next;
#db_execution returns execution
while ( my $sth = db_execution ( $db, $low , $high ) ) {
...
#fetch row operation
...
}
$pm->finish;
}
sub db_execution {
...
my $dbh = $db->connect( 'students' ) or die $!;
my $sth = $dbh->prepare( $sql ) or die "$!:" . $dbh->errstr;
$sth->execute or die "$!:" . $sth->errstr;
...
}
The same code is executing with out parallel processing. What is the issue? How to resolve is this?