【发布时间】:2018-02-22 09:21:00
【问题描述】:
昨晚在线用户急剧增加后,我遇到了mysql CPU使用率的问题。平均服务器负载为 150(1 分钟),顶部的 mysql CPU 使用率为 3500-4000%。演出流程清单;结果是 250 个查询。以下是一些设置和状态:
max_connections=400
query_cache_type=1
join_buffer_size=4096
query_cache_size=5M
query_cache_limit=1048576
query_cache_min_res_unit=4096
这里是执行的
show status like '%qcach%';
30 秒内 3 次
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| Qcache_free_blocks | 597 |
| Qcache_free_memory | 1658184 |
| Qcache_hits | 1813237610 |
| Qcache_inserts | 456473072 |
| Qcache_lowmem_prunes | 433310255 |
| Qcache_not_cached | 105476947 |
| Qcache_queries_in_cache | 1564 |
| Qcache_total_blocks | 4027 |
+-------------------------+------------+
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| Qcache_free_blocks | 429 |
| Qcache_free_memory | 1422288 |
| Qcache_hits | 1813245095 |
| Qcache_inserts | 456475419 |
| Qcache_lowmem_prunes | 433312602 |
| Qcache_not_cached | 105477523 |
| Qcache_queries_in_cache | 1553 |
| Qcache_total_blocks | 3896 |
+-------------------------+------------+
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| Qcache_free_blocks | 481 |
| Qcache_free_memory | 1546088 |
| Qcache_hits | 1813254695 |
| Qcache_inserts | 456477824 |
| Qcache_lowmem_prunes | 433314721 |
| Qcache_not_cached | 105478263 |
| Qcache_queries_in_cache | 1699 |
| Qcache_total_blocks | 4146 |
+-------------------------+------------+
服务器配置:
2 x Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz.
64GB RAM
Mysql running on SSDs.
【问题讨论】: