gpt4 book ai didi

Mysql通过缓冲降低CPU使用率

转载 作者:行者123 更新时间:2023-11-29 03:13:37 26 4
gpt4 key购买 nike

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

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

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

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

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

我混合了 Innodb、MyIsam 和内存表。

这是调谐器脚本的输出

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

最佳答案

因为您有 3GB 的空闲空间,所以增加您的 innodb_buffer_pool_size 以容纳您的整个 innodb 数据集(数据 + 索引)。

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

关于Mysql通过缓冲降低CPU使用率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4279143/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com