NAME
Loop::Sustainable::Strategy::MySQL::BalancedReplication - Calculates wait interval by MySQL slave server delaying.
SYNOPSIS
use Loop::Sustainable;
my $dbh_slave = DBI->connect(...);
loop_sustainable {
### master heavy process
} (
sub {
### termination condition
},
{
strategy => {
class => 'MySQL::BalancedReplication',
args => {
dbh => $dbh_slave,
capable_behind_seconds => 2,
on_error_scale_factor => 30,
on_error_croak => 0,
},
}
}
);
DESCRIPTION
METHODS
new( %args )
- dbh
-
DBI::db object. The $dbh must be connected to MySQL slave server with previledge 'SHOW SLAVE STATUS' command.
- capable_behind_seconds
-
Permits seconds of replication delaying. This module treats delaying times as this value from read delay times via Seconds_Behind_Master value.
Default value is 5 seconds.
- on_error_scale_factor
-
When a error is occuring in fetching slave status, This module treats delay times as multiply temporary delay times by this value.
Default value is 5.
- on_error_croak
-
When a error is occuring in fetching slave status and this value is true value, This module will raise error. Default value is false.
wait_correction( $query, $time_sum, $executed_count )
AUTHOR
Toru Yamaguchi <zigorou@dena.jp<gt>
LICENSE
This module is licensed under the same terms as Perl itself.