Al Duccino

Member
Feb 26, 2009
9
0
51
Hi,
first of all, sorry about my bad English.

I would like to optimize mysql, i have the default mysql (cpanel) settings right now :
Code:
[mysqld]
set-variable = max_connections=500
log-slow-queries
safe-show-database
bind-address = 127.0.0.1

Here is my mysqltuner.pl result
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.1.63-cll
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 523M (Tables: 2578)
[--] Data in InnoDB tables: 8M (Tables: 422)
[--] Data in MEMORY tables: 0B (Tables: 25)
[!!] Total fragmented tables: 503

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 11d 18h 35m 3s (36M q [36.255 qps], 1M conn, TX: 277B, RX: 8B)
[--] Reads / Writes: 85% / 15%
[--] Total buffers: 34.0M global + 2.7M per thread (500 max threads)
[OK] Maximum possible memory usage: 1.4G (5% of installed RAM)
[OK] Slow queries: 0% (2/36M)
[OK] Highest usage of available connections: 51% (258/500)
[OK] Key buffer size / total MyISAM indexes: 8.0M/190.4M
[OK] Key buffer hit rate: 95.6% (1B cached / 53M reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (8K temp sorts / 3M sorts)
[!!] Joins performed without indexes: 144980
[!!] Temporary tables created on disk: 26% (580K on disk / 2M total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 0% (64 open / 5M opened)
[OK] Open file limit used: 4% (117/2K)
[OK] Table locks acquired immediately: 99% (44M immediate / 44M locks)
[!!] InnoDB data size / buffer pool: 8.9M/8.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
    Set thread_cache_size to 4 as a starting value
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    query_cache_size (>= 8M)
    join_buffer_size (> 128.0K, or always use indexes with joins)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    thread_cache_size (start at 4)
    table_cache (> 64)
    innodb_buffer_pool_size (>= 8M)
I would really appreciate some help to optimize my.cnf.
Thank you in advance for your help.
 
Last edited:

srpurdy

Well-Known Member
Jun 1, 2011
101
0
66
cPanel Access Level
Root Administrator
Start here

Under [mysqld] section
Code:
query_cache_size=64M
query_cache_limit=8M
query_cache_type=1

thread_cache_size=8

table_open_cache=4096

innodb_buffer_pool_size=10M
key_buffer_size=220M
read_buffer_size=256K
sort_buffer_size=256K
join_buffer_size=256K

tmp_table_size=32M
max_heap_table_size=32M
Under [mysql_safe]
Code:
open_files_limit=8192
after that restart mysql, wait a few days before doing a new report.
 

Al Duccino

Member
Feb 26, 2009
9
0
51
Here are my new results :

Code:
 >>  MySQLTuner 1.2.0 - Major Hayden <[email protected]>
 >>  Bug reports, feature requests, and downloads at [url]http://mysqltuner.com/[/url]
 >>  Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.63-cll
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 531M (Tables: 2578)
[--] Data in InnoDB tables: 8M (Tables: 422)
[--] Data in MEMORY tables: 0B (Tables: 25)
[!!] Total fragmented tables: 513

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 11d 8h 53m 48s (23M q [23.452 qps], 389K conn, TX: 60B, RX: 5B)
[--] Reads / Writes: 72% / 28%
[--] Total buffers: 328.0M global + 1.2M per thread (500 max threads)
[OK] Maximum possible memory usage: 953.0M (3% of installed RAM)
[OK] Slow queries: 0% (0/23M)
[OK] Highest usage of available connections: 4% (24/500)
[OK] Key buffer size / total MyISAM indexes: 220.0M/194.7M
[OK] Key buffer hit rate: 99.9% (330M cached / 171K reads)
[OK] Query cache efficiency: 72.3% (13M cached / 18M selects)
[!!] Query cache prunes per day: 69753
[OK] Sorts requiring temporary tables: 0% (66 temp sorts / 1M sorts)
[!!] Joins performed without indexes: 611055
[OK] Temporary tables created on disk: 19% (413K on disk / 2M total)
[OK] Thread cache hit rate: 99% (379 created / 389K connections)
[!!] Table cache hit rate: 11% (4K open / 36K opened)
[OK] Open file limit used: 71% (6K/8K)
[OK] Table locks acquired immediately: 99% (11M immediate / 11M locks)
[OK] InnoDB data size / buffer pool: 8.9M/10.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Adjust your join queries to always utilize indexes
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    query_cache_size (> 64M)
    join_buffer_size (> 256.0K, or always use indexes with joins)
    table_cache (> 4096)
 

srpurdy

Well-Known Member
Jun 1, 2011
101
0
66
cPanel Access Level
Root Administrator
query_cache_size = 128M

Next step would be to optimize your database. 611,055 joins without indexes means your database is badly designed. You can increase join_buffer_size but 256K has been proven to be the best setting. Your better off indexing all the tables that need indexing.

You can turn on logging of queries without indexes in the mysql configuration as well. This will try to help you figure out which tables are missing indexes.