I have a dedicated server with the following specifications: Intel i7 CPU [email protected] with 24GB RAM, Plesk 11,5,30 (CentOS 5.5), but I have a problem with optimizing MySQL database. I have a CMS portal (Joomla) and database size is around 200 MB. Portal has 20-30000 inputs per day, and the problem happens when we let the links on our Facebook page, which has about 70,000 fans. Site and server simply suffocate the base load, so I asked someone to help me how to properly adjust my my.cnf.
Here are the results of mysqltuner:
my.cnf:
Here are the results of mysqltuner:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.95-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 164M (Tables: 775)
[--] Data in InnoDB tables: 14M (Tables: 383)
[!!] Total fragmented tables: 25
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 17h 28m 26s (26M q [178.436 qps], 380K conn, TX: 397B, RX: 4B)
[--] Reads / Writes: 92% / 8%
[--] Total buffers: 186.0M global + 13.2M per thread (800 max threads)
[OK] Maximum possible memory usage: 10.5G (44% of installed RAM)
[OK] Slow queries: 0% (235/26M)
[OK] Highest usage of available connections: 16% (134/800)
[OK] Key buffer size / total MyISAM indexes: 128.0M/46.0M
[OK] Key buffer hit rate: 100.0% (4B cached / 36K reads)
[OK] Query cache efficiency: 47.3% (11M cached / 23M selects)
[!!] Query cache prunes per day: 48472
[OK] Sorts requiring temporary tables: 0% (126 temp sorts / 919K sorts)
[!!] Temporary tables created on disk: 49% (517K on disk / 1M total)
[OK] Thread cache hit rate: 99% (134 created / 380K connections)
[!!] Table cache hit rate: 4% (1K open / 25K opened)
[OK] Open file limit used: 1% (1K/65K)
[OK] Table locks acquired immediately: 99% (13M immediate / 13M locks)
[!!] InnoDB data size / buffer pool: 14.8M/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
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:
query_cache_size (> 32M)
tmp_table_size (> 32M)
max_heap_table_size (> 16M)
table_cache (> 1024)
innodb_buffer_pool_size (>= 14M)
my.cnf:
[mysqld]
local-infile=0
datadir=/var/lib/mysql
#skip_innodb
skip-locking
skip-bdb
#skip-networking
safe-show-database
query_cache_limit=16M
query_cache_size=64M ## 32MB
query_cache_type=1
max_connections=800
#interactive_timeout=10
#wait_timeout=20
#connect_timeout=20
thread_cache_size=32M
key_buffer=128M ## 128M
#join_buffer=2M
max_connect_errors=20
max_allowed_packet=16M
table_cache=4M
max_heap_table_size=32M
record_buffer=1M
sort_buffer_size=4M ## 1MB
read_buffer_size=4M ## 1M
read_rnd_buffer_size=4M ## 1MB
myisam_sort_buffer_size=32M
server-id=1
log-slow-queries = /var/log/mysql_slow_queries.log
# this can be used on your own wish.
#collation-server=latin1_general_ci
[mysql.server]
user=mysql
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/lib/mysql/mysql.pid
open_files_limit=8192
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
#safe-updates
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M
[mysqlhotcopy]
interactive-timeout