mehnihma

Well-Known Member
Dec 15, 2012
57
1
8
cPanel Access Level
Root Administrator
I have some MySQL problems, I am not sure how to tune memory settings

From mysqltuner.pl:

>> MySQLTuner 1.3.0 - Major Hayden <[email protected]>
>> Bug reports, feature requests, and downloads at MySQLTuner-perl by major
>> Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.6.16-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 7M (Tables: 61)
[--] Data in InnoDB tables: 84M (Tables: 2251)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 52)
[!!] Total fragmented tables: 33

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 11d 0h 57m 2s (4M q [4.870 qps], 92K conn, TX: 11B, RX: 1B)
[--] Reads / Writes: 74% / 26%
[--] Total buffers: 12.6G global + 128.9M per thread (400 max threads)
[!!] Maximum possible memory usage: 63.0G (404% of installed RAM)
[OK] Slow queries: 0% (66/4M)
[OK] Highest usage of available connections: 4% (18/400)
[OK] Key buffer size / total MyISAM indexes: 256.0M/1.6M
[OK] Key buffer hit rate: 98.9% (553K cached / 6K reads)
[OK] Query cache efficiency: 67.9% (2M cached / 3M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (16 temp sorts / 86K sorts)
[!!] Joins performed without indexes: 4897
[!!] Temporary tables created on disk: 29% (82K on disk / 275K total)
[OK] Thread cache hit rate: 99% (18 created / 92K connections)
[!!] Table cache hit rate: 0% (2K open / 229K opened)
[OK] Open file limit used: 1% (151/9K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[OK] InnoDB buffer pool / data size: 12.0G/84.8M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Reduce your overall MySQL memory footprint for system stability
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
Increase table_cache gradually to avoid file descriptor limits
Read this before increasing table_cache over 64: table_cache negative scalability - MySQL Performance Blog
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
join_buffer_size (> 128.0M, or always use indexes with joins)
tmp_table_size (> 128M)
max_heap_table_size (> 128M)
table_cache (> 2000)


my.cfn:

[mysqld]
# InnoDB settings
innodb_buffer_pool_size=12G
innodb_log_file_size=2G


# Binary log/replication
log-bin
sync_binlog=1
sync_relay_log=1
relay-log-info-repository=TABLE
master-info-repository=TABLE
expire_logs_days=10
binlog_format=ROW
transaction-isolation=READ-COMMITTED
innodb_autoinc_lock_mode = 2

# Other
#timezone=GMT+1
character-set-server=utf8
collation-server=utf8_general_ci
max-connect-errors=100000
max-connections=500
open_files_limit=9708
query_cache_type=1
join_buffer_size=128M
tmp_table_size=128M
max_heap_table_size=128M
query_cache_limit=128M
key_buffer = 256M
query_cache_size = 256M
max_connections = 400
innodb_lock_wait_timeout = 100


I have server with 16GB ram and MySQL 5.6 I am not sure how to set it properly and ask for advice

Thanks
 

mehnihma

Well-Known Member
Dec 15, 2012
57
1
8
cPanel Access Level
Root Administrator
HI

I have changed something and now have this:


>> MySQLTuner 1.3.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] Currently running supported MySQL version 5.6.16-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 6M (Tables: 61)
[--] Data in InnoDB tables: 81M (Tables: 2251)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 52)
[!!] Total fragmented tables: 20

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 4m 12s (1K q [4.032 qps], 54 conn, TX: 2M, RX: 306K)
[--] Reads / Writes: 89% / 11%
[--] Total buffers: 3.3G global + 2.9M per thread (500 max threads)
[OK] Maximum possible memory usage: 4.7G (30% of installed RAM)
[OK] Slow queries: 4% (48/1K)
[OK] Highest usage of available connections: 0% (2/500)
[OK] Key buffer size / total MyISAM indexes: 128.0M/1.4M
[!!] Key buffer hit rate: 87.7% (300 cached / 37 reads)
[OK] Query cache efficiency: 26.7% (220 cached / 823 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 50 sorts)
[OK] Temporary tables created on disk: 12% (8 on disk / 63 total)
[OK] Thread cache hit rate: 96% (2 created / 54 connections)
[!!] Table cache hit rate: 9% (2K open / 21K opened)
[OK] Open file limit used: 1% (144/9K)
[OK] Table locks acquired immediately: 100% (724 immediate / 724 locks)
[OK] InnoDB buffer pool / data size: 3.0G/81.8M
[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
Increase table_cache gradually to avoid file descriptor limits
Read this before increasing table_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
table_cache (> 2000)

[~/tuner]#

my.cfn:

[mysqld]
# InnoDB settings
innodb_buffer_pool_size=3G
innodb_log_file_size=2G
default-storage-engine=InnoDB


# Binary log/replication
log-bin
sync_binlog=1
sync_relay_log=1
relay-log-info-repository=TABLE
master-info-repository=TABLE
expire_logs_days=10
binlog_format=ROW
transaction-isolation=READ-COMMITTED
innodb_autoinc_lock_mode = 2

# Other
#timezone=GMT+1
character-set-server=utf8
collation-server=utf8_general_ci
open_files_limit=9782
query_cache_type=1
join_buffer_size=2M
tmp_table_size=64M
query_cache_size=128M
query_cache_limit = 64M
key_buffer=64M
key_buffer_size=128M
max_connections = 500
innodb_lock_wait_timeout = 100
thread_cache_size=2005
long_query_time = 5
max_heap_table_size=128M
log-queries-not-using-indexes
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log


Can you help me to set it up?

Also when I add table_cache to my.cfn, MySQL does not load?

Thanks
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,260
463
You should let MySQL run for at least 24 hours to get accurate results from a tuner. Your second test shows that it was only running for around four minutes.

Thank you.