<

USING MYSQLTUNER

Published on
230 Points
230 Views
Last Modified:
MySQLTuner is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions.

REQUIREMENTS

Before you start, you'll need the following:


IMPORTANT NOTICE

The MySQLTuner script will make suggestions for changes you can make to your server to optimize your MySQL services. Media Temple does not support any suggested configuration changes. We encourage you to back up your service before making any of the changes recommended by the script.


This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by Media Temple. Please take a moment to review the Statement of Support. Please consult the MySQLTuner blog for further assistance.


INSTRUCTIONS

  1. Log into your server with a root or sudo user via SSH.
  2. Download MySQLTuner by executing the following command:
    wget -O mysqltuner.pl https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl --no-check-certificate
  3. Give the script 775 permissions:
    chmod 775 mysqltuner.pl
  4. Run the script with the following command:
    perl mysqltuner.pl
  5. The script should run and then display statistics and recommendations. Sample output:
    >>  MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net> >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/ >>  Run with '--help' for additional options and output filtering 
    -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.0.77 [OK] Operating on 32-bit architecture with less than 2GB RAM 
    -------- Storage Engine Statistics ------------------------------------------- [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 122K (Tables: 99) [--] Data in InnoDB tables: 52M (Tables: 155) [!!] Total fragmented tables: 5 
    -------- Performance Metrics ------------------------------------------------- [--] Up for: 262d 23h 58m 26s (2M q [0.121 qps], 328K conn, TX: 572M, RX: 207M) [--] Reads / Writes: 66% / 34% [--] Total buffers: 35.0M global + 2.7M per thread (100 max threads) [OK] Maximum possible memory usage: 303.7M (45% of installed RAM) [OK] Slow queries: 0% (3/2M) [OK] Highest usage of available connections: 5% (5/100) [OK] Key buffer size / total MyISAM indexes: 8.0M/401.0K [!!] Key buffer hit rate: 93.9% (110K cached / 6K reads) [OK] Query cache efficiency: 82.8% (932K cached / 1M selects) [OK] Query cache prunes per day: 11 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 29K sorts) [OK] Temporary tables created on disk: 25% (88K on disk / 348K total) [!!] Thread cache is disabled [!!] Table cache hit rate: 0% (64 open / 184K opened) [OK] Open file limit used: 8% (86/1K) [OK] Table locks acquired immediately: 100% (339K immediate / 339K locks) [!!] InnoDB data size / buffer pool: 52.6M/2.0M 
    -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Enable the slow query log to troubleshoot bad queries Set thread_cache_size to 4 as a starting value Increase table_cache gradually to avoid file descriptor limits Variables to adjust: thread_cache_size (start at 4) table_cache (> 64) innodb_buffer_pool_size (>= 52M)
    
  6. Feel free to implement these suggestions at your own discretion.


For more tips, visit Media Temple's Support Community.


If you haven't already ordered your new DV server from Media Temple, click here to do that now.

0
Comment
0 Comments

Join & Write a Comment

With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month