Hi
I need to optimize mysql to get the benefit from available ram. I am also interested in using ramdrive/tmpfs for temporary tables created on disk.
my.cnf
mysqltuner.pl
tuning-primer
I need to optimize mysql to get the benefit from available ram. I am also interested in using ramdrive/tmpfs for temporary tables created on disk.
my.cnf
Code:
[mysqld]
innodb_file_per_table = 1
local-infile=0
query_cache_size = 128M
query_cache_type = 1
thread_cache_size = 4
query_cache_limit = 10M
open_files_limit = 3544
tmp_table_size = 32M
max_heap_table_size = 32M
table_cache = 1k
Code:
>> MySQLTuner 1.2.0 - Major Hayden <[email protected]>
>> 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.5.35-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 1G (Tables: 2688)
[--] Data in InnoDB tables: 50M (Tables: 635)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 0B (Tables: 9)
[!!] Total fragmented tables: 54
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 3d 7h 0m 15s (56M q [198.937 qps], 1M conn, TX: 12042B, RX: 7B)
[--] Reads / Writes: 96% / 4%
[--] Total buffers: 312.0M global + 2.8M per thread (151 max threads)
[OK] Maximum possible memory usage: 727.2M (1% of installed RAM)
[OK] Slow queries: 0% (491/56M)
[!!] Highest connection usage: 100% (152/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/438.4M
[OK] Key buffer hit rate: 99.5% (3B cached / 16M reads)
[OK] Query cache efficiency: 58.2% (29M cached / 50M selects)
[!!] Query cache prunes per day: 4039839
[OK] Sorts requiring temporary tables: 9% (350K temp sorts / 3M sorts)
[!!] Temporary tables created on disk: 44% (1M on disk / 2M total)
[OK] Thread cache hit rate: 92% (90K created / 1M connections)
[!!] Table cache hit rate: 0% (1K open / 121K opened)
[OK] Open file limit used: 55% (1K/3K)
[OK] Table locks acquired immediately: 99% (25M immediate / 25M locks)
[OK] InnoDB data size / buffer pool: 50.2M/128.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
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 (> 151)
wait_timeout (< 28800)
interactive_timeout (< 28800)
query_cache_size (> 128M)
tmp_table_size (> 32M)
max_heap_table_size (> 32M)
table_cache (> 1024)
Code:
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.5.35-cll x86_64
Uptime = 3 days 6 hrs 59 min 27 sec
Avg. qps = 198
Total Questions = 56570314
Threads Connected = 5
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.5/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 NOT enabled.
Current long_query_time = 10.000000 sec.
You have 491 out of 56570336 that take longer than 10.000000 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.5/en/point-in-time-recovery.html
WORKER THREADS
Current thread_cache_size = 4
Current threads_cached = 2
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 5
Historic max_used_connections = 152
The number of used connections is 100% of the configured maximum.
You should raise max_connections
INNODB STATUS
Current InnoDB index space = 21 M
Current InnoDB data space = 50 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 128 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 : 698 M
Configured Max Per-thread Buffers : 415 M
Configured Max Global Buffers : 280 M
Configured Max Memory Limit : 695 M
Physical Memory : 70.65 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 438 M
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 196
Key buffer free ratio = 73 %
Your key_buffer_size seems to be fine
QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 116 M
Current query_cache_limit = 10 M
Current Query cache Memory fill ratio = 91.32 %
Current query_cache_min_res_unit = 4 K
However, 13295265 queries have been removed from the query cache due to lack of memory
Perhaps you should raise query_cache_size
MySQL won't cache query results that are larger than query_cache_limit in size
SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 132.00 K
You have had 374 queries where a join could not use an index properly
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 = 3544 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine
TABLE CACHE
Current table_open_cache = 1024 tables
Current table_definition_cache = 400 tables
You have a total of 3373 tables
You have 1024 open tables.
Current table_cache hit rate is 0%
, while 100% of your table cache is in use
You should probably increase your table_cache
You should probably increase your table_definition_cache value.
TEMP TABLES
Current max_heap_table_size = 32 M
Current tmp_table_size = 32 M
Of 1382889 temp tables, 44% 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 = 128 K
Current table scan ratio = 34741 : 1
You have a high ratio of sequential access requests to SELECTs
You may benefit from raising read_buffer_size and/or improving your use of index es.
TABLE LOCKING
Current Lock Wait ratio = 1 : 132
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=ALWAYS'.