5

我有一个非常普通的 mysql 5.1 设置,我正在尝试调整它。我发现了这个方便的脚本

它提出了以下建议:

query_cache_limit (> 1M, or use smaller result sets)
query_cache_size (> 16M)
join_buffer_size (> 128.0K, or always use indexes with joins)
table_cache (> 64)
innodb_buffer_pool_size (>= 14G)

在阅读这些含义以及它们当前设置的内容时,我发现我可以运行“mysqladmin variables”

我目前的价值观是:

query_cache_limit                       | 1048576  
query_cache_size                        | 16777216   
join_buffer_size                        | 131072     
innodb_buffer_pool_size                 | 8388608  

我如何阅读这些,它们是千字节吗?那是1M,16M,13M和8M吗?

我的盒子只有 4G 的 Ram,在正常的一天只有几百兆的可用内存。我应该遵循这些建议并做:

#innodb_buffer_pool_size = 15G
#table_cache = 128
#join_buffer_size = 32M
#query_cache_size = 64M
#query_cache_limit = 2M

我对15G感到困惑,这是磁盘空间的事情,而不是内存的事情?如果是这样,那么建议不是很好,对吧?

我应该为我的盒子获得更多内存吗?

更多信息: - 我的数据库大小是 34Gigs,我使用所有的 innodb,我有 71 个表,其中 4 个很大,其余的都很小。我一直在考虑将大的移动到 SOLR 并从那里进行所有查询,但想看看我能用基本调整做什么。

谢谢乔尔

4

1 回答 1

0

您不应将 innodb 缓冲池设置为高于可用内存。该脚本可能会根据表中的记录数及其物理大小建议这样做。Innodb 的性能很大程度上是基于内存的,如果它可以适应内存中的索引,性能将会迅速而明显地下降。所以设置 innodb_buffer_pool_size 高几乎总是好的建议。

Innodb is not the best table type for everything when it comes to mysql. Very large tables that generally have a lot of inserts, but few reads and updates (i.e. logging) are better off as MyISAM tables. Your very active tables (inserts, updates, deletes, selects) are better off Innodb. There may be a flame war on this advice, and it is generic advice.

But that said, no script is going to being to tell you what your settings should be. It can only make a best guest. The best settings are based on your data access patterns. You really have to read up on what all the variables are. mysqlperformanceblog.com is an excellent place for learning about mysql, in addition to the manual.

When in mysql, use "show variables" and "show status" to see what's going on. You can also run "show innodb status", but you may not understand that output if you don't know what the variables are.

于 2011-11-04T22:49:06.080 回答