My turn! mySQL Optimization
Hi everyone!
My server came with an empty my.cnf and nothing setup on it. Nice of them, wasnt it?
8GB of memory (with a free total 32GB memory upgrade being installed this week) and quad Xeon 3.2GHz 2048kb cache CPUs.
my.cnf:
I am a complete mySQL novice. This server is used for Wordpress / WooCommerce. I'm adding another site to the server that will double its mySQL usage, as well in about 2 weeks. Thanks so much to any tips you can provide to speed this pig up! I see a lot of "help me optimize" thread, and we are all EXTREMELY grateful to you pros for your services. Ben
root@dwhs205 [~/bin]# ./mysqltuner.pl
>> MySQLTuner 1.3.0 - Major Hayden
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.5.36-cll
[!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 97M (Tables: 381)
[--] Data in InnoDB tables: 120M (Tables: 404)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 157
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 22h 6m 0s (8M q [105.983 qps], 65K conn, TX: 12B, RX: 1B)
[--] Reads / Writes: 89% / 11%
[--] Total buffers: 744.0M global + 8.3M per thread (151 max threads)
[OK] Maximum possible memory usage: 2.0G (25% of installed RAM)
[OK] Slow queries: 0% (0/8M)
[OK] Highest usage of available connections: 33% (50/151)
[OK] Key buffer size / total MyISAM indexes: 100.0M/24.2M
[OK] Key buffer hit rate: 100.0% (40M cached / 8K reads)
[OK] Query cache efficiency: 87.3% (6M cached / 8M selects)
[!!] Query cache prunes per day: 62957
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 340K sorts)
[!!] Temporary tables created on disk: 31% (125K on disk / 398K total)
[OK] Thread cache hit rate: 99% (66 created / 65K connections)
[OK] Table cache hit rate: 99% (943 open / 952 opened)
[OK] Open file limit used: 1% (863/50K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[OK] InnoDB buffer pool / data size: 500.0M/120.4M
[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
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
query_cache_size (> 128M)
tmp_table_size (> 2G)
max_heap_table_size (> 32K)
my.cnf:
[mysqld]
query_cache_limit = 32M
query_cache_size = 128M
query_cache_type = 1
open_files_limit=6000
table_open_cache = 25000
table_definition_cache = 2000
key_buffer_size = 100M
innodb_buffer_pool_size = 500M
innodb_buffer_pool_instances = 4
join_buffer_size=2M
read_rnd_buffer_size=4M
tmp_table_size = 2048M
max_heap_table_size = 32K
thread_cache_size = 32
I am a complete mySQL novice. This server is used for Wordpress / WooCommerce. I'm adding another site to the server that will double its mySQL usage, as well in about 2 weeks. Thanks so much to any tips you can provide to speed this pig up! I see a lot of "help me optimize" thread, and we are all EXTREMELY grateful to you pros for your services. Ben
-
Hello :) I just wanted to point out that you may want to run the tuner again after adding the additional site that's going to increase your MySQL usage. The results may change, depending on what improvements you make from the user feedback to this thread. Thank you. 0 -
[quote="beninfl, post: 1652161">Hi everyone! My server came with an empty my.cnf and nothing setup on it. Nice of them, wasnt it? Ben
The my.cnf file is usually empty when it's delivered to customers. You have to adjust the variables values yourself or with assistance, according to your needs.0 -
Michael: Thanks, I was planning for that. I just wanted to make sure all was well with it. The memory usage on the server is EXTREMELY low right now, I rarely see it use more than 800MB out of 8GB in htop. Archmactrix: Of course. That's why I'm here, to help optimize my config file and server. ;) Any suggestions? Ben 0
Please sign in to leave a comment.
Comments
3 comments