mysql 调整变量 - current &默认值

发布于 2024-12-13 17:57:07 字数 1138 浏览 4 评论 0原文

我有一个非常普通的 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变量”

我当前的值是:

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

如何读取这些,它们是Kbytes吗?那么是1M、16M、13M、8M吗?

我的盒子只有 4G 内存,平时只有几百兆可用内存。我应该遵循这些建议并执行以下操作:

#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 并从那里执行所有查询,但想看看我可以通过基本调整做什么。

谢谢 乔尔

I have a pretty vanilla mysql 5.1 setup, and I am trying to tune it. I found this handy script

It made the following suggestions:

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)

In reading up on what these mean and what they are currently set to, I found that I can run "mysqladmin variables"

My current values are:

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

How do I read these, are they Kbytes? so is that 1M, 16M, 13M and 8M?

My box is only 4G of Ram and on a normal day only had a few hundred megs free of memory. Should I follow these suggestions and do:

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

Im confused by the 15G, is this a disk space thing, not a memory thing? If so then the recommendations are not very good right?

Should I get more memory for my box?

More Info:
- My db size is 34Gigs, I use all innodb, I have 71 tables, 4 of them are huge, the rest are small. Ive been thinking of moving the big ones to SOLR and doing all queries from there, but wanted to see what I can do with basic tuning.

thanks
Joel

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

自我难过 2024-12-20 17:57:07

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

对于 mysql 来说,Innodb 并不是万能的最佳表类型。通常具有大量插入但很少读取和更新(即日志记录)的非常大的表最好采用 MyISAM 表。您非常活跃的表(插入、更新、删除、选择)最好使用 Innodb。这个建议可能会引起激烈的争论,而且它是通用的建议。

但话虽如此,没有脚本会告诉您您的设置应该是什么。它只能成为最好的客人。最佳设置基于您的数据访问模式。您确实必须阅读所有变量是什么。除了手册之外,mysqlperformanceblog.com 也是学习 mysql 的绝佳场所。

在 mysql 中,使用“显示变量”和“显示状态”来查看发生了什么。您还可以运行“show innodb status”,但如果您不知道变量是什么,您可能无法理解该输出。

You should not set your innodb buffer pool higher than your available memory. The script probably recommended that based on the number of records in your table and their physical size. Innodb performance is very much memory based, if it can fit the indexes in memory, performance is going to drop quickly and noticeably. So setting innodb_buffer_pool_size high is almost always good advice.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文