MySQL 性能调优
我一直在努力解决这个问题,但到目前为止还无法解决。 我有使用 MyISAM 引擎的包含 41 个表的数据库。目前数据库的总大小为 96.7MB。
问题是“MySQL 运行时信息”显示的统计数据非常惊人。这些都是:
Handler_read_rnd = 1,495K
Handler_read_rnd_next = 51M
Created_tmp_disk_tables = 31K
打开的表数 = 217K
我设置了以下值:
key_buffer_size = 768 MB
query_cache_size = 40 MB
表缓存 = 800
tmp_table_size = 64 MB
sort_buffer_size = 20 MB
read_rnd_buffer_size = 6 MB
我的服务器运行的是具有 6GB RAM 的 Linux。我重新启动了数据库服务器,因此 MySQL 服务器已经运行了 2 天 10 小时 34 分 14 秒。
有什么建议可以改善这些性能问题吗?
还有一件事要问:table_cache = 800 <- 800是什么,KB还是MB?
I have been struggling to fix this issue but I couldn't so far.
I have database with 41 tables using MyISAM engine. The overall size of the database is 96.7MB right now.
The problem is that "MySQL runtime information" shows very alarming stats. These are:
Handler_read_rnd = 1,495K
Handler_read_rnd_next = 51M
Created_tmp_disk_tables = 31K
Opened_tables = 217K
I have set following values:
key_buffer_size = 768 MB
query_cache_size = 40 MB
table_cache = 800
tmp_table_size = 64 MB
sort_buffer_size = 20 MB
read_rnd_buffer_size = 6 MB
My server is running Linux with 6GB RAM. I restarted the db server so MySQL server has been running for 2 days, 10 hours, 34 minutes and 14 seconds.
Any suggestion to improve these performance issues?
One more thing to ask: table_cache = 800 <- 800 is what, KB or MB ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定您的 my.cnf 正在被使用吗?使用显示全局变量并验证您的设置是否确实被使用。
至于 800,这就是将被缓存的表句柄的数量。
鉴于您的设置和结果,我不得不怀疑您的设置没有得到遵守。
顺便说一句,在构建和调优大型 MySQL 系统(复数)多年之后,我个人的建议是使用 InnoDB。优点之一是无需转动如此神秘且简单的旋钮即可获得合理的开箱即用行为和性能。
Are you certain that your my.cnf is being used? Use show global variables and verify that your settings are actually being used.
As far as the 800, that's the number of table handles that will be cached.
Given your settings and results, I have to suspect that your settings aren't being honored.
BTW my personal advice after many years of building and tuning big MySQL systems (plural) is to use InnoDB. One of the advantages is no need to turn such arcane and simple knobs to get reasonable out of the box behavior and performance.