my.cnf设置为DV4 8GB

时间:2012-10-08 15:10:18

标签: mysql database wordpress

我在MediaTemple DV4服务器上有一个带有8GB RAM的Wordpress站点。该数据库有超过35K的帖子,在高峰时段,该网站有300到400个并发用户。该主页对wp_posts表运行6个查询。

有人可以就my.cnf文件的最佳设置提供任何建议吗?感谢。

 query-cache-type = 1
 query-cache-size = 256M
 query_cache_limit = 1M
 thread_cache_size = 256
 max_connections = 350
 tmp_table_size=256M
 max_heap_table_size=256M
 table_cache= 1024
 join_buffer_size = 5M
 key_buffer_size = 512M
 wait_timeout = 60
 local-infile=0
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 user=mysql
 # Disabling symbolic-links is recommended to prevent assorted security risks
 symbolic-links=0

MySQLTuner性能指标:

 -------- Storage Engine Statistics -------------------------------------------
 [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
 [--] Data in MyISAM tables: 963M (Tables: 504)
 [--] Data in InnoDB tables: 4M (Tables: 198)
 [!!] Total fragmented tables: 218

 [--] Up for: 2d 18h 10m 22s (27M q [113.837 qps], 1M conn, TX: 489B, RX: 4B)
 [--] Reads / Writes: 97% / 3%
 [--] Total buffers: 1.4G global + 7.6M per thread (350 max threads)
 [OK] Maximum possible memory usage: 4.0G (42% of installed RAM)
 [OK] Slow queries: 0% (3K/27M)
 [!!] Highest connection usage: 86%  (301/350)
 [OK] Key buffer size / total MyISAM indexes: 128.0M/679.6M
 [OK] Key buffer hit rate: 100.0% (1B cached / 57K reads)
 [OK] Query cache efficiency: 67.8% (14M cached / 20M selects)
 [!!] Query cache prunes per day: 29253
 [OK] Sorts requiring temporary tables: 0% (1K temp sorts / 1M sorts)
 [!!] Temporary tables created on disk: 35% (688K on disk / 1M total)
 [OK] Thread cache hit rate: 99% (463 created / 1M connections)
 [OK] Table cache hit rate: 31% (1K open / 3K opened)
 [OK] Open file limit used: 42% (1K/2K)
 [OK] Table locks acquired immediately: 99% (7M immediate / 7M locks)
 [OK] InnoDB data size / buffer pool: 4.3M/32.0M

1 个答案:

答案 0 :(得分:1)

可能您可以查看查询的大小,可能是1M太大而且更小 - 但经常运行 - 查询不会被缓存。

pt-query-digest是一个很好的工具: http://www.percona.com/doc/percona-toolkit/2.1/pt-query-digest.html

有关一般提示,您可以使用: http://mysqltuner.pl 请记住,它们只是通用的建议,所以不要盲目跟随它们,但通常在优化MySql时脚本的输出是一个好的开始。

key_buffer_size仅与您使用MyISAM表有关(不要!)。

如果您希望数据库与InnoDB一起顺利运行,那么请提高 innodb_buffer_pool_size高于实际数据库大小(如果可能的话)

相关问题