Skip to content

Commit bbc04d8

Browse files
committed
#258 new rule for innodb log file size (25% of Buffer pool size)
1 parent cff9e62 commit bbc04d8

File tree

1 file changed

+22
-64
lines changed

1 file changed

+22
-64
lines changed

mysqltuner.pl

Lines changed: 22 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,65 +3958,6 @@ sub mysqsl_pfs {
39583958
}
39593959
infoprint "No information found or indicators desactivated." if ($nbL == 1);
39603960

3961-
return;
3962-
3963-
##
3964-
##################################################################################
3965-
#statements_with_sorting
3966-
#mysql> desc statements_with_sorting;
3967-
#+-------------------+---------------------+------+-----+---------------------+-------+
3968-
#| Field | Type | Null | Key | Default | Extra |
3969-
#+-------------------+---------------------+------+-----+---------------------+-------+
3970-
#| query | longtext | YES | | NULL | |
3971-
#| db | varchar(64) | YES | | NULL | |
3972-
#| exec_count | bigint(20) unsigned | NO | | NULL | |
3973-
#| total_latency | text | YES | | NULL | |
3974-
#| sort_merge_passes | bigint(20) unsigned | NO | | NULL | |
3975-
#| avg_sort_merges | decimal(21,0) | NO | | 0 | |
3976-
#| sorts_using_scans | bigint(20) unsigned | NO | | NULL | |
3977-
#| sort_using_range | bigint(20) unsigned | NO | | NULL | |
3978-
#| rows_sorted | bigint(20) unsigned | NO | | NULL | |
3979-
#| avg_rows_sorted | decimal(21,0) | NO | | 0 | |
3980-
#| first_seen | timestamp | NO | | 0000-00-00 00:00:00 | |
3981-
#| last_seen | timestamp | NO | | 0000-00-00 00:00:00 | |
3982-
#| digest | varchar(32) | YES | | NULL | |
3983-
#+-------------------+---------------------+------+-----+---------------------+-------+
3984-
#13 rows in set (0,00 sec)
3985-
return;
3986-
3987-
subheaderprint "Performance schema: TOP 15 most row look queries (95% percentile)";
3988-
$nbL=1;
3989-
for my $lQuery(select_array ('use sys;select db, query, rows_examined AS search from statements_with_runtimes_in_95th_percentile ORDER BY rows_examined DESC LIMIT 15;')) {
3990-
infoprint " +-- $nbL: $lQuery";
3991-
$nbL++;
3992-
}
3993-
infoprint "No information found or indicators desactivated." if ($nbL == 1);
3994-
3995-
3996-
subheaderprint "Performance schema: TOP 15 max latency queries (95% percentile)";
3997-
$nbL=1;
3998-
for my $lQuery(select_array ('use sys;select db, query, max_latency AS search from statements_with_runtimes_in_95th_percentile ORDER BY max_latency DESC LIMIT 15;')) {
3999-
infoprint " +-- $nbL: $lQuery";
4000-
$nbL++;
4001-
}
4002-
infoprint "No information found or indicators desactivated." if ($nbL == 1);
4003-
4004-
subheaderprint "Performance schema: TOP 15 average latency queries (95% percentile)";
4005-
$nbL=1;
4006-
for my $lQuery(select_array ('use sys;select db, query, avg_latency AS search from statements_with_runtimes_in_95th_percentile ORDER BY avg_latency DESC LIMIT 15;')) {
4007-
infoprint " +-- $nbL: $lQuery";
4008-
$nbL++;
4009-
}
4010-
infoprint "No information found or indicators desactivated." if ($nbL == 1);
4011-
4012-
subheaderprint "Performance schema: XXXXXXX";
4013-
$nbL=1;
4014-
for my $lQuery(select_array ('select "none";')) {
4015-
infoprint " +-- $nbL: $lQuery";
4016-
$nbL++;
4017-
}
4018-
infoprint "No information found or indicators desactivated." if ($nbL == 1);
4019-
40203961

40213962
return;
40223963
##################################################################################
@@ -4692,9 +4633,14 @@ sub mysql_innodb {
46924633
infoprint " +-- InnoDB Additional Mem Pool: "
46934634
. hr_bytes( $myvar{'innodb_additional_mem_pool_size'} ) . "";
46944635
}
4636+
if ( defined $myvar{'innodb_log_file_size'} ) {
4637+
infoprint " +-- InnoDB Log File Size: "
4638+
. hr_bytes( $myvar{'innodb_log_file_size'} ) . "(".$mycalc{'innodb_log_size_pct'}." % of buffer pool)";
4639+
}
4640+
46954641
if ( defined $myvar{'innodb_log_buffer_size'} ) {
46964642
infoprint " +-- InnoDB Log Buffer: "
4697-
. hr_bytes( $myvar{'innodb_log_buffer_size'} ) . "(".percentage($mycalc{'innodb_log_size_pct'}).")";
4643+
. hr_bytes( $myvar{'innodb_log_buffer_size'} ) ;
46984644
}
46994645
if ( defined $mystat{'Innodb_buffer_pool_pages_free'} ) {
47004646
infoprint " +-- InnoDB Log Buffer Free: "
@@ -4721,7 +4667,19 @@ sub mysql_innodb {
47214667
. hr_bytes_rnd( $enginestats{'InnoDB'} )
47224668
. ") if possible." );
47234669
}
4724-
4670+
if ($mycalc{'innodb_log_size_pct'} < 20 or $mycalc{'innodb_log_size_pct'} > 30) {
4671+
badprint "Ratio InnoDB log file size / InnoDb Buffer pool size (".
4672+
$mycalc{'innodb_log_size_pct'}.
4673+
" %): " . hr_bytes( $myvar{'innodb_log_file_size'} ) . "/"
4674+
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " should be equal 25%";
4675+
push( @adjvars,
4676+
"innodb_log_file_size should be equals to 1/4 of buffer pool size (= "
4677+
. hr_bytes_rnd( $myvar{'innodb_buffer_pool_size'}/4 ) . ") if possible." );
4678+
} else {
4679+
goodprint "InnoDB log file size / InnoDb Buffer pool size: "
4680+
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . "/"
4681+
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " should be equal 25%";
4682+
}
47254683
# InnoDB Buffer Pull Instances (MySQL 5.6.6+)
47264684
if ( defined( $myvar{'innodb_buffer_pool_instances'} ) ) {
47274685

@@ -4763,7 +4721,7 @@ sub mysql_innodb {
47634721
else {
47644722
if ( $myvar{'innodb_buffer_pool_instances'} != 1 ) {
47654723
badprint
4766-
"InnoDB buffer pool <= 1G and innodb_buffer_pool_instances(!=1).";
4724+
"InnoDB buffer pool <= 1G and Innodb_buffer_pool_instances(!=1).";
47674725
push( @adjvars, "innodb_buffer_pool_instances (=1)" );
47684726
}
47694727
else {
@@ -4793,11 +4751,11 @@ sub mysql_innodb {
47934751
)
47944752
{
47954753
goodprint
4796-
"innodb_buffer_pool_size is aligned with value innodb_buffer_pool_chunk_size and innodb_buffer_pool_instances";
4754+
"Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances";
47974755
}
47984756
else {
47994757
badprint
4800-
"innodb_buffer_pool_size is not aligned with value innodb_buffer_pool_chunk_size and innodb_buffer_pool_instances";
4758+
"Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances";
48014759

48024760
#push( @adjvars, "Adjust innodb_buffer_pool_instances, innodb_buffer_pool_chunk_size with innodb_buffer_pool_size" );
48034761
push( @adjvars,

0 commit comments

Comments
 (0)