2

我的 Mysql 服务器负载很重,现在平均 300 qps。

它平均使用 %50 Cpu 和 700MB 内存。我的服务器有 8GB,它有超过 3GB 的免费空间。慢查询日志似乎很好。很少,而且不常见。

我想确保它返回缓存的结果并且不要不必要地触摸磁盘。

我认为 linux 操作系统缓存了 innodb 文件,但我可以相信吗?有没有什么好的做法可以通过缓冲或缓存来降低 CPU 使用率?

innodb_buffer_pool_size 设置为默认值。(8mb)

我混合了 Innodb、MyIsam 和 Memory 表。

这是调谐器脚本的输出

INNODB STATUS
Current InnoDB index space = 238 M
Current InnoDB data space = 294 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 8 M

KEY BUFFER
Current MyISAM index space = 113 M
Current key_buffer_size = 192 M
Key cache miss rate is 1 : 63
Key buffer free ratio = 74 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 256 M
Current query_cache_used = 19 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 7.64 %
Current query_cache_min_res_unit = 4 K
Query Cache is 28 % fragmented
4

1 回答 1

1

由于您有 3GB 可用空间,因此请提高您innodb_buffer_pool_size的容量以保存整个 innodb 数据集(数据 + 索引)。

给它一个 1G,让它有一些喘息的空间。你不会后悔的。:)

于 2010-11-25T22:39:34.303 回答