MYSQL PERFORMANCE TUNING PRIMER and MySQLTuner 1.1.1

Last updated on December 1st, 2010 at 12:53 am

[root@server src]# ./tuning-primer.sh

-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.0.88-community-log i686

Uptime = 22 days 18 hrs 12 min 36 sec
Avg. qps = 14
Total Questions = 28279137
Threads Connected = 4
[adrotate banner="1"]
Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 10 sec.
You have 12474 out of 28279199 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 328
Current threads_cached = 99
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 2
Historic max_used_connections = 101
The number of used connections is 101% of the configured maximum.
You should raise max_connections

INNODB STATUS
Current InnoDB index space = 4 M
Current InnoDB data space = 29 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 30 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 653 M
Configured Max Per-thread Buffers : 362 M
Configured Max Global Buffers : 288 M
Configured Max Memory Limit : 650 M
Physical Memory : 1010 M
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 119 M
Current key_buffer_size = 128 M
Key cache miss rate is 1 : 4965
Key buffer free ratio = 50 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 57 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 45.28 %
Current query_cache_min_res_unit = 4 K
Query Cache is 22 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 1 M
Current read_rnd_buffer_size = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 516.00 K
You have had 4810 queries where a join could not use an index properly
You have had 4 joins without keys that check for key usage after each row
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 4206 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
You currently have open more than 75% of your open_files_limit
You should set a higher value for open_files_limit in my.cnf

TABLE CACHE
Current table_cache value = 2048 tables
You have a total of 1767 tables
You have 2048 open tables.
Current table_cache hit rate is 17%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 128 M
Current tmp_table_size = 128 M
Of 153169 temp tables, 32% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 214 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 257
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.
[adrotate banner="2"]
[root@server src]# ./mysqltuner.pl

>> MySQLTuner 1.1.1 - Major Hayden
>> 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.88-community-log
[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: 609M (Tables: 1625)
[--] Data in InnoDB tables: 29M (Tables: 120)
[--] Data in MEMORY tables: 0B (Tables: 5)
[!!] Total fragmented tables: 53

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 22d 18h 15m 30s (28M q [14.382 qps], 2M conn, TX: 2B, RX: 3B)
[--] Reads / Writes: 73% / 27%
[--] Total buffers: 416.0M global + 3.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 778.1M (77% of installed RAM)
[OK] Slow queries: 0% (12K/28M)
[!!] Highest connection usage: 100% (101/100)
[OK] Key buffer size / total MyISAM indexes: 128.0M/119.4M
[OK] Key buffer hit rate: 100.0% (1B cached / 263K reads)
[OK] Query cache efficiency: 41.9% (6M cached / 16M selects)
[!!] Query cache prunes per day: 10636
[OK] Sorts requiring temporary tables: 4% (35K temp sorts / 757K sorts)
[!!] Temporary tables created on disk: 32% (74K on disk / 227K total)
[OK] Thread cache hit rate: 99% (101 created / 2M connections)
[!!] Table cache hit rate: 17% (2K open / 11K opened)
[OK] Open file limit used: 84% (3K/4K)
[OK] Table locks acquired immediately: 99% (14M immediate / 14M locks)
[OK] InnoDB data size / buffer pool: 29.5M/30.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Reduce or eliminate persistent connections to reduce connection usage
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:
max_connections (> 100)
wait_timeout (< 15)
interactive_timeout (< 100) query_cache_size (> 128M)
tmp_table_size (> 128M)
max_heap_table_size (> 128M)
table_cache (> 2048)

[root@server src]#

Tags:

1 thought on “MYSQL PERFORMANCE TUNING PRIMER and MySQLTuner 1.1.1”

  1. Hello,I find out that your weblog is incredibly beneficial and helpful and we wonder if there can be a possibility of obtaining More content like this on your web site. If you willing to support us out, we will be willing to compensate you… Best regards, Desirae Ridings

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.