- Original Poster
- #1
I have noticed that I was getting huge disk IO issues on my server, by chance when it was under load I restarted mySQL (it took an absolute age to close). I have been trying to optimise it and this is where I am so far.
This is a VM using Xenserver with 16GB Ram, Total processors: 4 (Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz) and the storage is 2 x SATA3 drives using an Adaptec RAID card. When something like a backup or anything that requires mySQL to work happens it really hammers the disk IO. Memory is rarely over 30% usage and CPU is only ever really IO Wait.
This is the mysql tuner recommendations:
This is my my.cnf
This is a VM using Xenserver with 16GB Ram, Total processors: 4 (Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz) and the storage is 2 x SATA3 drives using an Adaptec RAID card. When something like a backup or anything that requires mySQL to work happens it really hammers the disk IO. Memory is rarely over 30% usage and CPU is only ever really IO Wait.
This is the mysql tuner recommendations:
Code:
>> MySQLTuner 1.4.0 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] Logged in using credentials passed on the command line
[OK] Currently running supported MySQL version 5.5.42-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 1G (Tables: 1007)
[--] Data in InnoDB tables: 385M (Tables: 547)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 624K (Tables: 11)
[!!] Total fragmented tables: 567
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 15h 32m 9s (6M q [125.077 qps], 102K conn, TX: 31B, RX: 1B)
[--] Reads / Writes: 82% / 18%
[--] Total buffers: 536.0M global + 131.4M per thread (300 max threads)
[!!] Maximum possible memory usage: 39.0G (257% of installed RAM)
[OK] Slow queries: 0% (589/6M)
[OK] Highest usage of available connections: 73% (221/300)
[OK] Key buffer size / total MyISAM indexes: 64.0M/257.0M
[OK] Key buffer hit rate: 100.0% (424M cached / 147K reads)
[OK] Query cache efficiency: 83.1% (3M cached / 4M selects)
[!!] Query cache prunes per day: 20487
[OK] Sorts requiring temporary tables: 0% (126 temp sorts / 209K sorts)
[!!] Joins performed without indexes: 9746
[!!] Temporary tables created on disk: 43% (37K on disk / 85K total)
[OK] Thread cache hit rate: 99% (535 created / 102K connections)
[OK] Table cache hit rate: 75% (3K open / 4K opened)
[OK] Open file limit used: 35% (3K/10K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[!!] InnoDB buffer pool / data size: 128.0M/385.0M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Reduce your overall MySQL memory footprint for system stability
Increasing the query_cache size over 128M may reduce 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
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_size (> 256M) [see warning above]
join_buffer_size (> 128.0M, or always use indexes with joins)
tmp_table_size (> 128M)
max_heap_table_size (> 64M)
innodb_buffer_pool_size (>= 385M)
This is my my.cnf
Code:
[mysqld]
open_files_limit=10000
max_connections = 300
query-cache-type = 1
query-cache-size = 256M
query-cache-limit = 2M
thread_cache_size=40
wait_timeout=50
max_delayed_threads=1
delayed_insert_timeout=30
max_allowed_packet=16M
table_open_cache= 3000
innodb_buffer_pool_size=128M
tmp_table_size=128M
max_heap_table_size=64M
key_buffer_size=64M
join_buffer_size=128M
innodb_additional_mem_pool_size = 16M
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
log-slow-queries=/var/lib/mysql/slow.log
table_cache = 4096
sort_buffer_size = 2M
read_buffer_size = 128K
read_rnd_buffer_size = 1M
[mysqldump]
quick