Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

MySQL Tuner Optimization

mysql

  • Please log in to reply
5 replies to this topic

#1 phpforfun

phpforfun

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1056 posts

Posted 08 July 2009 - 08:36 AM

Hey guys, if you are having MySQL issues on a linux box, try using this, its called MySQL Tuner. Its a neat little tool that tells you why your MySQL Configuration sucks, and it tells you how to fix it. Idiot proof

CD To Src
cd /usr/local/src/

Download it
wget http://mysqltuner.com/mysqltuner.pl

Chmod it
chmod +x mysqltuner.pl

Run It
./mysqltuner.pl

Here is what it will output.. atleast for my server before I optimized it

[root@svr2 src]# ./mysqltuner.pl

>> MySQLTuner 1.0.0 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at MySQLTuner - MySQLTuner
>> 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.81-community-log
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 708M (Tables: 4947)
[--] Data in InnoDB tables: 107M (Tables: 157)
[--] Data in MEMORY tables: 756K (Tables: 8)
[!!] Total fragmented tables: 176

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 6h 11m 0s (8M q [77.526 qps], 287K conn, TX: 4B, RX: 994M)
[--] Reads / Writes: 48% / 52%
[--] Total buffers: 587.0M global + 2.7M per thread (500 max threads)
[OK] Maximum possible memory usage: 1.9G (47% of installed RAM)
[OK] Slow queries: 0% (36/8M)
[OK] Highest usage of available connections: 6% (30/500)
[OK] Key buffer size / total MyISAM indexes: 409.0M/412.5M
[OK] Key buffer hit rate: 98.1% (64M cached / 1M reads)
[OK] Query cache efficiency: 64.6% (3M cached / 5M selects)
[!!] Query cache prunes per day: 41878
[OK] Sorts requiring temporary tables: 1% (4K temp sorts / 320K sorts)
[!!] Joins performed without indexes: 1594
[!!] Temporary tables created on disk: 36% (36K on disk / 98K total)
[OK] Thread cache hit rate: 98% (5K created / 287K connections)
[!!] Table cache hit rate: 0% (70 open / 170K opened)
[OK] Open file limit used: 3% (132/4K)
[OK] Table locks acquired immediately: 99% (4M immediate / 4M locks)
[!!] InnoDB data size / buffer pool: 107.3M/106.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Adjust your join queries to always utilize indexes
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 40M)
join_buffer_size (> 128.0K, or always use indexes with joins)
tmp_table_size (> 50M)
max_heap_table_size (> 30M)
table_cache (> 70)
innodb_buffer_pool_size (>= 107M)


Edited by phpforfun, 08 July 2009 - 11:57 AM.

  • 1

#2 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 08 July 2009 - 09:27 AM

I got a 404 is it only accessible through the linux command line?
  • 0

#3 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 08 July 2009 - 10:44 AM

Very cool script, thanks for the share! +rep

@Blaine: I think he wrote the URL wrong. It should be http://mysqltuner.com/mysqltuner.pl
(note the u instead of an i).
  • 0

#4 BlaineSch

BlaineSch

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1559 posts

Posted 08 July 2009 - 11:05 AM

Good eye jordan lol
  • 0

#5 phpforfun

phpforfun

    Speaks fluent binary

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1056 posts

Posted 08 July 2009 - 11:57 AM

Fixed :)
  • 0

#6 whwmia

whwmia

    CC Newcomer

  • Just Joined
  • PipPip
  • 24 posts

Posted 11 October 2009 - 10:56 PM

Nice one ! Thank You !
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download