Adding preconisations on binlog cache and Aborted connections
This commit is contained in:
parent
4121ed73fd
commit
731fe6908d
1 changed files with 46 additions and 6 deletions
|
@ -854,6 +854,12 @@ sub calculations {
|
||||||
$mycalc{'pct_connections_used'} = int(($mystat{'Max_used_connections'}/$myvar{'max_connections'}) * 100);
|
$mycalc{'pct_connections_used'} = int(($mystat{'Max_used_connections'}/$myvar{'max_connections'}) * 100);
|
||||||
$mycalc{'pct_connections_used'} = ($mycalc{'pct_connections_used'} > 100) ? 100 : $mycalc{'pct_connections_used'} ;
|
$mycalc{'pct_connections_used'} = ($mycalc{'pct_connections_used'} > 100) ? 100 : $mycalc{'pct_connections_used'} ;
|
||||||
|
|
||||||
|
# Aborted Connections
|
||||||
|
$mycalc{'pct_connections_aborted'} = percentage($mystat{'Aborted_connects'}, $mystat{'Connections'});
|
||||||
|
debugprint "Aborted_connects: ".$mystat{'Aborted_connects'}."\n";
|
||||||
|
debugprint "Connections: ".$mystat{'Connections'}."\n";
|
||||||
|
debugprint "pct_connections_aborted: ".$mycalc{'pct_connections_aborted'}."\n";
|
||||||
|
|
||||||
# Key buffers
|
# Key buffers
|
||||||
if (mysql_version_ge(4, 1) && $myvar{'key_buffer_size'} > 0) {
|
if (mysql_version_ge(4, 1) && $myvar{'key_buffer_size'} > 0) {
|
||||||
$mycalc{'pct_key_buffer_used'} = sprintf("%.1f",(1 - (($mystat{'Key_blocks_unused'} * $myvar{'key_cache_block_size'}) / $myvar{'key_buffer_size'})) * 100);
|
$mycalc{'pct_key_buffer_used'} = sprintf("%.1f",(1 - (($mystat{'Key_blocks_unused'} * $myvar{'key_cache_block_size'}) / $myvar{'key_buffer_size'})) * 100);
|
||||||
|
@ -954,6 +960,11 @@ sub calculations {
|
||||||
if ($myvar{'have_innodb'} eq "YES") {
|
if ($myvar{'have_innodb'} eq "YES") {
|
||||||
$mycalc{'innodb_log_size_pct'} = ($myvar{'innodb_log_file_size'} * 100 / $myvar{'innodb_buffer_pool_size'});
|
$mycalc{'innodb_log_size_pct'} = ($myvar{'innodb_log_file_size'} * 100 / $myvar{'innodb_buffer_pool_size'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Binlog Cache
|
||||||
|
if ($myvar{'log_bin'} ne 'OFF') {
|
||||||
|
$mycalc{'pct_binlog_cache'} = percentage( $mystat{'Binlog_cache_use'} - $mystat{'Binlog_cache_disk_use'}, $mystat{'Binlog_cache_use'} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub mysql_stats {
|
sub mysql_stats {
|
||||||
|
@ -966,6 +977,12 @@ sub mysql_stats {
|
||||||
" q [".hr_num($qps)." qps], ".hr_num($mystat{'Connections'})." conn,".
|
" q [".hr_num($qps)." qps], ".hr_num($mystat{'Connections'})." conn,".
|
||||||
" TX: ".hr_num($mystat{'Bytes_sent'}).", RX: ".hr_num($mystat{'Bytes_received'}).")\n";
|
" TX: ".hr_num($mystat{'Bytes_sent'}).", RX: ".hr_num($mystat{'Bytes_received'}).")\n";
|
||||||
infoprint "Reads / Writes: ".$mycalc{'pct_reads'}."% / ".$mycalc{'pct_writes'}."%\n";
|
infoprint "Reads / Writes: ".$mycalc{'pct_reads'}."% / ".$mycalc{'pct_writes'}."%\n";
|
||||||
|
# Binlog Cache
|
||||||
|
if ($myvar{'log_bin'} eq 'OFF') {
|
||||||
|
infoprint "Binary logging is disabled\n";
|
||||||
|
} else {
|
||||||
|
infoprint "Binary logging is enabled (GTID MODE: ".(defined ($myvar{'gtid_mode'})?$myvar{'gtid_mode'}:"OFF").")\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Memory usage
|
# Memory usage
|
||||||
infoprint "Total buffers: ".hr_bytes($mycalc{'server_buffers'})." global + ".hr_bytes($mycalc{'per_thread_buffers'})." per thread ($myvar{'max_connections'} max threads)\n";
|
infoprint "Total buffers: ".hr_bytes($mycalc{'server_buffers'})." global + ".hr_bytes($mycalc{'per_thread_buffers'})." per thread ($myvar{'max_connections'} max threads)\n";
|
||||||
|
@ -978,8 +995,6 @@ sub mysql_stats {
|
||||||
if (defined $myvar{'query_cache_type'}) {
|
if (defined $myvar{'query_cache_type'}) {
|
||||||
infoprint "Query Cache Buffers\n";
|
infoprint "Query Cache Buffers\n";
|
||||||
infoprint " +-- Query Cache: ".$myvar{'query_cache_type'}." - " .($myvar{'query_cache_type'} eq 0| $myvar{'query_cache_type'} eq 'OFF'?"DISABLED":($myvar{'query_cache_type'} eq 1?"ALL REQUESTS":"ON DEMAND")) . "\n";
|
infoprint " +-- Query Cache: ".$myvar{'query_cache_type'}." - " .($myvar{'query_cache_type'} eq 0| $myvar{'query_cache_type'} eq 'OFF'?"DISABLED":($myvar{'query_cache_type'} eq 1?"ALL REQUESTS":"ON DEMAND")) . "\n";
|
||||||
}
|
|
||||||
if (defined $myvar{'query_cache_size'}) {
|
|
||||||
infoprint " +-- Query Cache Size: " . hr_bytes($myvar{'query_cache_size'}) . "\n";
|
infoprint " +-- Query Cache Size: " . hr_bytes($myvar{'query_cache_size'}) . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,6 +1004,10 @@ sub mysql_stats {
|
||||||
infoprint " +-- Sort Buffer: " . hr_bytes($myvar{'sort_buffer_size'}) . "\n";
|
infoprint " +-- Sort Buffer: " . hr_bytes($myvar{'sort_buffer_size'}) . "\n";
|
||||||
infoprint " +-- Thread stack: " . hr_bytes($myvar{'thread_stack'}) . "\n";
|
infoprint " +-- Thread stack: " . hr_bytes($myvar{'thread_stack'}) . "\n";
|
||||||
infoprint " +-- Join Buffer: " . hr_bytes($myvar{'join_buffer_size'}) . "\n";
|
infoprint " +-- Join Buffer: " . hr_bytes($myvar{'join_buffer_size'}) . "\n";
|
||||||
|
if ( $myvar{'log_bin'} ne 'OFF') {
|
||||||
|
infoprint "Binlog Cache Buffers\n";
|
||||||
|
infoprint " +-- Binlog Cache: ". hr_bytes($myvar{'binlog_cache_size'})."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arch && $arch == 32 && $mycalc{'total_possible_used_memory'} > 2*1024*1024*1024) {
|
if ($arch && $arch == 32 && $mycalc{'total_possible_used_memory'} > 2*1024*1024*1024) {
|
||||||
|
@ -1022,6 +1041,14 @@ sub mysql_stats {
|
||||||
goodprint "Highest usage of available connections: $mycalc{'pct_connections_used'}% ($mystat{'Max_used_connections'}/$myvar{'max_connections'})\n";
|
goodprint "Highest usage of available connections: $mycalc{'pct_connections_used'}% ($mystat{'Max_used_connections'}/$myvar{'max_connections'})\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Aborted Connections
|
||||||
|
if ($mycalc{'pct_connections_aborted'} > 3) {
|
||||||
|
badprint "Aborded connections: $mycalc{'pct_connections_aborted'}% ($mystat{'Aborted_connects'}/$mystat{'Connections'})\n";
|
||||||
|
push(@generalrec,"Reduce or eliminate unclosed connexions and network issues")
|
||||||
|
} else {
|
||||||
|
goodprint "Aborded connections: $mycalc{'pct_connections_aborted'}% ($mystat{'Aborted_connects'}/$mystat{'Connections'})\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Key buffer
|
# Key buffer
|
||||||
if (!defined($mycalc{'total_myisam_indexes'}) and $doremote == 1) {
|
if (!defined($mycalc{'total_myisam_indexes'}) and $doremote == 1) {
|
||||||
push(@generalrec,"Unable to calculate MyISAM indexes on remote MySQL server < 5.0.0");
|
push(@generalrec,"Unable to calculate MyISAM indexes on remote MySQL server < 5.0.0");
|
||||||
|
@ -1109,7 +1136,7 @@ sub mysql_stats {
|
||||||
push(@adjvars,"max_heap_table_size (> ".hr_bytes_rnd($myvar{'max_heap_table_size'}).")");
|
push(@adjvars,"max_heap_table_size (> ".hr_bytes_rnd($myvar{'max_heap_table_size'}).")");
|
||||||
push(@generalrec,"When making adjustments, make tmp_table_size/max_heap_table_size equal");
|
push(@generalrec,"When making adjustments, make tmp_table_size/max_heap_table_size equal");
|
||||||
push(@generalrec,"Reduce your SELECT DISTINCT queries without LIMIT clauses");
|
push(@generalrec,"Reduce your SELECT DISTINCT queries without LIMIT clauses");
|
||||||
} elsif ($mycalc{'pct_temp_disk'} > 25 && $mycalc{'max_tmp_table_size'} >= 256) {
|
} elsif ($mycalc{'pct_temp_disk'} > 25 && $mycalc{'max_tmp_table_size'} >= 256*1024*1024) {
|
||||||
badprint "Temporary tables created on disk: $mycalc{'pct_temp_disk'}% (".hr_num($mystat{'Created_tmp_disk_tables'})." on disk / ".hr_num($mystat{'Created_tmp_tables'})." total)\n";
|
badprint "Temporary tables created on disk: $mycalc{'pct_temp_disk'}% (".hr_num($mystat{'Created_tmp_disk_tables'})." on disk / ".hr_num($mystat{'Created_tmp_tables'})." total)\n";
|
||||||
push(@generalrec,"Temporary table size is already large - reduce result set size");
|
push(@generalrec,"Temporary table size is already large - reduce result set size");
|
||||||
push(@generalrec,"Reduce your SELECT DISTINCT queries without LIMIT clauses");
|
push(@generalrec,"Reduce your SELECT DISTINCT queries without LIMIT clauses");
|
||||||
|
@ -1173,6 +1200,19 @@ sub mysql_stats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Binlog cache
|
||||||
|
if (defined $mycalc{'pct_binlog_cache'}) {
|
||||||
|
infoprint "Binlog cache memory access: ".$mycalc{'pct_binlog_cache'} ."% ( ".($mystat{'Binlog_cache_use'}-$mystat{'Binlog_cache_disk_use'})." Memory / ".$mystat{'Binlog_cache_use'}." Total)\n";
|
||||||
|
if ($mycalc{'pct_binlog_cache'} < 90 && $mystat{'Binlog_cache_use'}>0 ) {
|
||||||
|
badprint "Binlog cache access for memory: ".$mycalc{'pct_binlog_cache'}."% (should be >90%)\n";
|
||||||
|
push(@generalrec,"Increase binlog_cache_size (Actual value: ".$myvar{'binlog_cache_size'}.") ");
|
||||||
|
push(@adjvars,"binlog_cache_size (".hr_bytes($myvar{'binlog_cache_size'})." + 16K ) ");
|
||||||
|
} else {
|
||||||
|
goodprint "Binlog cache access from memory cache: ". $mycalc{'pct_binlog_cache'}."% \n";
|
||||||
|
infoprint "Not enought data to validate binlog cache size\n" if $mystat{'Binlog_cache_use'}<10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Performance options
|
# Performance options
|
||||||
if (!mysql_version_ge(4, 1)) {
|
if (!mysql_version_ge(4, 1)) {
|
||||||
push(@generalrec,"Upgrade to MySQL 4.1+ to use concurrent MyISAM inserts");
|
push(@generalrec,"Upgrade to MySQL 4.1+ to use concurrent MyISAM inserts");
|
||||||
|
|
Loading…
Reference in a new issue