Skip to content

Commit

Permalink
Merge pull request #681 from jmrenouard/master
Browse files Browse the repository at this point in the history
Newer versions of mysql ignore innodb_log_file_size, recommend innodb_redo_log_capacity instead. #657
  • Loading branch information
jmrenouard committed Jun 21, 2023
2 parents 57d1ea8 + 855b1b5 commit 84511a3
Showing 1 changed file with 61 additions and 34 deletions.
95 changes: 61 additions & 34 deletions mysqltuner.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
# mysqltuner.pl - Version 2.1.7
# mysqltuner.pl - Version 2.1.8
# High Performance MySQL Tuning Script
# Copyright (C) 2006-2023 Major Hayden - [email protected]
# Copyright (C) 2015-2023 Jean-Marie Renouard - [email protected]
Expand All @@ -16,7 +16,7 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
Expand Down Expand Up @@ -57,7 +57,7 @@ package main;
#use Env;

# Set up a few variables for use in the script
my $tunerversion = "2.1.7";
my $tunerversion = "2.1.8";
my ( @adjvars, @generalrec );

# Set defaults
Expand Down Expand Up @@ -6039,22 +6039,27 @@ sub mysql_innodb {
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
infoprint " +-- InnoDB Redo Log Capacity: "
. hr_bytes( $myvar{'innodb_redo_log_capacity'} );
}
if ( defined $myvar{'innodb_log_file_size'} ) {
infoprint " +-- InnoDB Log File Size: "
. hr_bytes( $myvar{'innodb_log_file_size'} );
}
if ( defined $myvar{'innodb_log_files_in_group'} ) {
infoprint " +-- InnoDB Log File In Group: "
. $myvar{'innodb_log_files_in_group'};
}
if ( defined $myvar{'innodb_log_files_in_group'} ) {
} else {
if ( defined $myvar{'innodb_log_file_size'} ) {
infoprint " +-- InnoDB Log File Size: "
. hr_bytes( $myvar{'innodb_log_file_size'} );
}
if ( defined $myvar{'innodb_log_files_in_group'} ) {
infoprint " +-- InnoDB Log File In Group: "
. $myvar{'innodb_log_files_in_group'};
infoprint " +-- InnoDB Total Log File Size: "
. hr_bytes( $myvar{'innodb_log_files_in_group'} *
$myvar{'innodb_log_file_size'} )
. "("
. $mycalc{'innodb_log_size_pct'}
. " % of buffer pool)";
} else {
infoprint " +-- InnoDB Total Log File Size: "
. hr_bytes( $myvar{'innodb_log_files_in_group'} *
$myvar{'innodb_log_file_size'} )
. "("
. $mycalc{'innodb_log_size_pct'}
. " % of buffer pool)";
. hr_bytes( $myvar{'innodb_log_file_size'} )
. "("
. $mycalc{'innodb_log_size_pct'}
. " % of buffer pool)";
}
}
if ( defined $myvar{'innodb_log_buffer_size'} ) {
infoprint " +-- InnoDB Log Buffer: "
Expand All @@ -6069,6 +6074,7 @@ sub mysql_innodb {
. hr_bytes( $mystat{'Innodb_buffer_pool_pages_total'} ) . "";
}
}
if ( defined $myvar{'innodb_thread_concurrency'} ) {
infoprint "InnoDB Thread Concurrency: "
. $myvar{'innodb_thread_concurrency'};
Expand All @@ -6077,8 +6083,7 @@ sub mysql_innodb {
# InnoDB Buffer Pool Size
if ( $myvar{'innodb_file_per_table'} eq "ON" ) {
goodprint "InnoDB File per table is activated";
}
else {
} else {
badprint "InnoDB File per table is not activated";
push( @adjvars, "innodb_file_per_table=ON" );
}
Expand All @@ -6088,8 +6093,7 @@ sub mysql_innodb {
goodprint "InnoDB buffer pool / data size: "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " / "
. hr_bytes( $enginestats{'InnoDB'} ) . "";
}
else {
} else {
badprint "InnoDB buffer pool / data size: "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " / "
. hr_bytes( $enginestats{'InnoDB'} ) . "";
Expand All @@ -6100,37 +6104,60 @@ sub mysql_innodb {
}
if ( $mycalc{'innodb_log_size_pct'} < 20
or $mycalc{'innodb_log_size_pct'} > 30 )
{
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
{
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
badprint "Ratio InnoDB redo log capacity / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push(
@adjvars,
"innodb_redo_log_capacity should be (="
. hr_bytes_rnd(
$myvar{'innodb_buffer_pool_size'} / 4
)
. ") if possible, so InnoDB Redo log Capacity equals 25% of buffer pool size."
);
} else {
badprint "Ratio InnoDB log file size / InnoDB Buffer pool size ("
. $mycalc{'innodb_log_size_pct'} . "%): "
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
. $myvar{'innodb_log_files_in_group'} . " / "
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
push(
push(
@adjvars,
"innodb_log_file_size should be (="
. hr_bytes_rnd(
$myvar{'innodb_buffer_pool_size'} /
$myvar{'innodb_log_files_in_group'} / 4
)
. ") if possible, so InnoDB total log file size equals 25% of buffer pool size."
);
if ( mysql_version_le( 5, 6, 2 ) ) {
);
}
if ( mysql_version_le( 5, 6, 2 ) ) {
push( @generalrec,
"For MySQL 5.6.2 and lower, total innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB."
);
}
push( @generalrec,
"Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU"
);
}
else {
goodprint "Ratio InnoDB log file size / InnoDB Buffer pool size: "
} else {
if ( defined $myvar{'innodb_redo_log_capacity'} ) {
goodprint "Ratio InnoDB Redo Log Capacity / InnoDB Buffer pool size: "
. hr_bytes( $myvar{'innodb_redo_log_capacity'} ) . "/"
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
} else {
push( @generalrec,
"Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU"
);
goodprint "Ratio InnoDB log file size / InnoDB Buffer pool size: "
. hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
. $myvar{'innodb_log_files_in_group'} . "/"
. hr_bytes( $myvar{'innodb_buffer_pool_size'} )
. " should be equal to 25%";
}
}
# InnoDB Buffer Pool Instances (MySQL 5.6.6+)
Expand Down Expand Up @@ -7070,7 +7097,7 @@ sub which {
=head1 NAME
MySQLTuner 2.1.7 - MySQL High Performance Tuning Script
MySQLTuner 2.1.8 - MySQL High Performance Tuning Script
=head1 IMPORTANT USAGE GUIDELINES
Expand Down

0 comments on commit 84511a3

Please sign in to comment.