mysqltuner的build议

我有一个运行Zen Cart的VPS。

该服务器build立在CentOS 5.7 64Bit上,并具有2个虚拟CPU和2GB RAM。 我尝试使用mysqltuner脚本来优化我的mysql数据库。

当前的query_cache_size设置为120MB,接近128MB的限制。 我不确定我应该继续增加这个数字作为build议或不。

另外,你能告诉我为什么查询caching修剪每天(171858)是如此之高? 我怎样才能减less这个?

-------- Performance Metrics ------------------------------------------------- [--] Up for: 7h 26m 48s (2M q [83.497 qps], 17K conn, TX: 6B, RX: 377M) [--] Reads / Writes: 87% / 13% [--] Total buffers: 196.0M global + 3.1M per thread (100 max threads) [OK] Maximum possible memory usage: 507.3M (24% of installed RAM) [OK] Slow queries: 0% (2/2M) [OK] Highest usage of available connections: 8% (8/100) [OK] Key buffer size / total MyISAM indexes: 50.0M/27.8M [OK] Key buffer hit rate: 100.0% (6M cached / 1K reads) [OK] Query cache efficiency: 88.4% (1M cached / 2M selects) [!!] Query cache prunes per day: 171858 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 13K sorts) [!!] Joins performed without indexes: 269 [OK] Temporary tables created on disk: 12% (1K on disk / 15K total) [OK] Thread cache hit rate: 99% (97 created / 17K connections) [OK] Table cache hit rate: 94% (434 open / 460 opened) [OK] Open file limit used: 16% (685/4K) [OK] Table locks acquired immediately: 99% (396K immediate / 396K locks) -------- 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 Adjust your join queries to always utilize indexes Variables to adjust: query_cache_size (> 120M) join_buffer_size (> 500.0K, or always use indexes with joins) ###My current my.cnf settings### query_cache_size = 120M thread_cache_size = 4 table_cache = 1000 key_buffer_size = 50M query_cache_limit = 20M join_buffer_size = 500K 

query_cache_size不限于128MB。 如果价值太高,可能会降低性能。

你可以有很多的查询caching修剪碎片,不一定是低内存。

您应该能够安全地将查询caching大小增加到160MB甚至192MB,但是如果开始看到降级,则可能需要将其缩小。

如果你的MySQL表一直在改变,那么查询caching就不会像使用(大部分)只读表一样高效。 如果数据更改,则查询caching必须至less使该条目无效并重新读取它。