什么时候MySQL INNODB 微调成为需要?

发布于 2024-10-20 19:43:11 字数 1050 浏览 7 评论 0原文

我看过这个:
http://www.mysqlperformanceblog .com/2009/01/12/should-you-move-from-myisam-to-innodb/
以及:
http://www.mysqlperformanceblog.com/2007/11 /01/innodb-performance-optimization-basics/

这些回答了我关于 INNODB 与 MyISAM 的很多问题。我心中毫无疑问INNODB是我应该走的路。不过,我正在自己工作,为了开发,我创建了一个 LAMP (ubuntu 10.10 x64) VM 服务器。目前该服务器拥有 2 GB 内存和单个 SATA 20GB 驱动器。我可以毫不费力地将这两个数量增加到大约 3-3.5 GB 内存和 200GB 驱动器。

我犹豫是否要切换到 INNODB 的原因是:
A) 上面的文章提到 INNODB 会大大增加表的大小,他建议使用更大的 RAM 和驱动器空间。虽然在生产环境中我不介意这种增加,但在开发环境中,我担心我无法适应。
B) 我真的不认为在我的虚拟机上微调 INNODB 引擎有什么意义。这可能是我在生产环境中甚至不允许做的事情。这些文章听起来好像如果不进行微调,INNODB 注定会失败。

我的问题是这样的。 INNODB什么时候可行?我需要多少 RAM 在我的服务器上运行 INNODB(仅使用我的数据进行测试。该服务器不向除我之外的任何人开放)?而且我可以安全地假设不允许我微调数据库的生产环境可能已经自己对其进行了微调吗?

另外,我是否对事情想得太多/过度担心了?

I had a look at this:
http://www.mysqlperformanceblog.com/2009/01/12/should-you-move-from-myisam-to-innodb/
and:
http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/

These answer a lot of my questions regarding INNODB vs MyISAM. There is no doubt in my mind that INNODB is the way I should go. However, I am working on my own and for development I have created a LAMP (ubuntu 10.10 x64) VM server. At present the server has 2 GB memory and a single SATA 20GB drive. I can increase both of these amounts without too much trouble to about 3-3.5 GB memory and a 200GB drive.

The reasons I hesitate to switch over to INNODB is:
A) The above articles mention that INNODB will vastly increase the size of the tables, and he recommends much larger amounts of RAM and drive space. While in a production environment I don't mind this increase, in a development environment, I fear I can not accommodate.

B) I don't really see any point in fine tuning the INNODB engine on my VM. This is likely something I will not even be allowed to do in my production environment. The articles make it sound like INNODB is doomed to fail without fine tuning.

My question is this. At what point is INNODB viable? How much RAM would I need to run INNODB on my server (with just my data for testing. This server is not open to anyone but me)? and also is it safe for me to assume that a production environment that will not allow me to fine tune the DB has likely already fine tuned it themselves?

Also, am I overthinking/overworrying about things?

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

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

发布评论

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

评论(2

梅倚清风 2024-10-27 19:43:11

恕我直言,当您有数万行,或者当您可以预测数据的增长率时,它就成为一个要求。

您需要重点调整 innodb 缓冲池和日志文件大小。另外,请确保启用了 innodb_file_per_table。

要了解 innodb 缓冲池的大小(以 KB 为单位),请运行以下查询:

SELECT SUM(data_length+index_length)/power(1024,1) IBPSize_KB
FROM information_schema.tables WHERE engine='InnoDB';

这里是以 MB 为单位

SELECT SUM(data_length+index_length)/power(1024,2) IBPSize_MB
FROM information_schema.tables WHERE engine='InnoDB';

这是以 GB 为单位

SELECT SUM(data_length+index_length)/power(1024,3) IBPSize_GB
FROM information_schema.tables WHERE engine='InnoDB';

我写了有关此类调整的文章

如果您受到服务器上 RAM 量的限制,为了操作系统的缘故,请勿超过已安装 RAM 量的 25%。

IMHO, it becomes a requirement when you have tens of thousands of rows, or when you can forecast the rate of growth for data.

You need to focus on tuning the innodb buffer pool and the log file size. Also, make sure you have innodb_file_per_table enabled.

To get an idea of how big to make the innodb buffer pool in KB, run this query:

SELECT SUM(data_length+index_length)/power(1024,1) IBPSize_KB
FROM information_schema.tables WHERE engine='InnoDB';

Here it is in MB

SELECT SUM(data_length+index_length)/power(1024,2) IBPSize_MB
FROM information_schema.tables WHERE engine='InnoDB';

Here it is in GB

SELECT SUM(data_length+index_length)/power(1024,3) IBPSize_GB
FROM information_schema.tables WHERE engine='InnoDB';

I wrote articles about this kind of tuning

IF you are limited by the amount of RAM on your server, do not surpass more than 25% of the installed for the sake of the OS.

对你的占有欲 2024-10-27 19:43:11

我觉得你可能想太多了。 INNODB 确实喜欢 ram,但如果你的数据库很小,我认为你不会遇到很多问题。我在使用 MYSQL 或任何其他数据库时遇到的唯一问题是,随着数据的增长,快速访问数据的要求也会随之增加。您还可以对表使用压缩来保持它们更小,但 INNODB 在数据完整性方面比 MYISAM 好得多。

在您遇到瓶颈之前,我也不会担心调整您的应用程序。编写高效的查询和数据库设计似乎比内存更重要,除非您正在处理非常大的数据集。

I think you may be over thinking things. Its true that INNODB loves ram but if your database is small I don't think you'll have many problems. The only issue I have had with MYSQL or any other database is that as the data grows so do the requirements for accessing it quickly. You can also use compression on the tables to keep them smaller but INNODB is vastly better than MYISAM at data integrity.

I also wouldn't worry about tuning your application until you run into a bottleneck. Writing efficient queries and database design seems to be more important than memory unless you're working with very large data sets.

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