MySQLTuner Revision 22 is now available

MySQLTuner revision 22 is available today. Here’s some of the notable fixes and changes:

» Changed how indexes are calculated on MySQL 5

Thanks to Jon Hinds, I found that when running the tuning script against MySQL 5, the following SQL statement caused MySQL to open all of the tables on the server, which of course caused the table cache hit rate to plummet each time the script is run:

SELECT SUM(INDEX_LENGTH) from information_schema.TABLES where ENGINE='MyISAM'

The script now calculates index size using du operations for all MySQL versions.

» Added checks for innodb_log_file_size

I’m working in some InnoDB support, and the script now checks to see whether the innodb_log_file_size is 25% (+/- 5%) of your innodb_buffer_pool_size.

» Added checks for 32-bit and 64-bit architectures

The script now determines if you have a 32-bit system with less than 2GB of RAM. You’ll get a polite suggestion to move to a 64-bit OS so that MySQL can allocate more than 2GB of RAM safely. Also, if your maximum possible memory usage is over 2GB on a 32-bit system, you’ll get a warning about stability issues. (Allocating more than 2GB on a 32-bit system can cause thread thrashing and a system crash.)

» Fixed a bug in the recommendations for temporary tables

I had a pretty ugly math error, and it’s fixed now. You will see recommendations for increasing the size of the max_heap_table and tmp_table_size buffers as long as they are not at 256MB already.

» Fixed thread cache recommendations and warnings

If your thread cache is set to 0, you now receive a warning about a disabled thread cache. Also, a separate recommendation is made in that situation. If your thread cache is set too low, but still enabled, a separate recommendation will appear.

» Internal changes

Some of the commented lines are switched around a bit, and some of the arrays have been consolidated to speed up the script a bit more.

Ready to download the script? Go to http://mysqltuner.com/ and get it for free.

One Response

  1. I was trying to get mysqltuner to work on OpenSolaris/SunOS (for use with a server at Joyent). Since the current stable revision doesn’t include support for Solaris-type systems, I was getting errors when trying to run the script.

    I made some quick modifications to mysqltuner to get the script to run. Here’s what I added near the end of the os_setup subroutine (around line 121):

    } elsif ($os =~ /SunOS/) {
    $physical_memory = `prtconf | grep Memory | cut -c 14- | awk ‘{print \$1}’` * 1048576;
    $swap_memory = `swap -l | grep ‘^/’ | awk ‘{print \$5}’`;
    }

    I’m not very familiar with SunOS or awk so I hope someone else can write a cleaner version of this, but at least it works fairly well. Also, the 64-bit OS detection code does not seem to detect the correct value on Solaris - you may want to look into that as well.

    (I didn’t figure out how to put this into a ticket on Trac.)

Leave a Reply