Loop::Sustainable::Strategy::MySQL::BalancedReplication - Calculates wait interval by MySQL slave server delaying.
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, }, } } );
DBI::db object. The $dbh must be connected to MySQL slave server with previledge 'SHOW SLAVE STATUS' command.
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.
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.
When a error is occuring in fetching slave status and this value is true value, This module will raise error. Default value is false.
Toru Yamaguchi <zigorou@dena.jp<gt>
This module is licensed under the same terms as Perl itself.
To install Loop::Sustainable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Loop::Sustainable
CPAN shell
perl -MCPAN -e shell install Loop::Sustainable
For more information on module installation, please visit the detailed CPAN module installation guide.