CPU MySQL 的利用率非常高 有时
CPU utilization in MySQL going very high Sometimes
如何优化 MySQL CPU 利用率有时很高?
这是我的 my.ini 文件
slow-query-log=1
long_query_time=10
server-id=1
max_connections=2000
table_open_cache=2000
tmp_table_size=391M
thread_cache_size=10
key_buffer_size=512M
read_buffer_size=64K
read_rnd_buffer_size=256K
innodb_additional_mem_pool_size=32M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=256M
innodb_buffer_pool_size=10G
innodb_log_file_size=512M
innodb_thread_concurrency=25
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=256M
max_connect_errors=100
open_files_limit=4161
query_cache_type=1
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
query_cache_size = 2084M
请建议对此进行任何更改以降低 cpu 高利用率?
my.ini [mysqld] 部分的建议(RPS = 每秒速率)
您可以在以 root 身份登录后为您的 MySQL 版本验证这些动态全局变量功能:
设置全局variable_name=variable_value; (注意 128K 为 128*1024,391M 为 391*1024*1024 - K & M 不允许进行动态更改)
就在每天更换 my.ini 之前。如果您的请求被拒绝并显示 'read_only' 消息,请跳过它并告诉我。
# 20180904 1137 from mysqlservertuning.com
# read_rnd_buffer_size=128K # from 256K to reduce handler_read_rnd_next RPS
# innodb_io_capacity=1000 # from 200 to allow additional HD RD and WD RPS
# read_buffer_size=128K # from 64K to reduce handler_read_next RPS
# max_connections=1000 # from 2000 because max_used_connections in 2 days was 244
# thread_cache_size=100 # from 10 to conserve CPU and reduce threads_created of 339 in 2 days
# max_heap_table_size=391M # from 16M to be = tmp_table_size and reduce created_tmp_disk_tables count
# innodb_lru_scan_depth=100 # from 1024 to reduce CPU busy every second see refman
# key_buffer_size=64M # from 512M because only 11% used today
# innodb_change_buffer_max_size=15 # from 25 percent because less than 1% used
# innodb_flushing_avg_loops=10 # from 30 to reduce flushing loop delay
每一天,将您当前的 my.ini 保存在 \history 中,并使用 DATED 定时文件名,例如 20180904-1137-my.ini 以便快速返回上次工作 my.ini。
第一次,将此块(包括前导日期和我们的网站名称)复制到 [mysqld] 部分的末尾,并通过删除前导 # 和 space 字符启用每天一次更改,监控之前继续下一个更改。
禁用前导# 和 space 条的 EARLIER 相同命名变量,以避免混淆。在 5 年内,您仍然会有 my.ini 更改的历史记录以及大致日期。
通常每天只更改一次,在进行下一次更改之前进行监控。如果更改似乎有害,请回到上次工作 my.ini 并告诉我们。
期待您 post实施后进行审核 + 7 天 mysqlservertuning.com、select 购物,select 您购买的商品 - 即使它是免费的,请向下滚动到评论并添加您的评论。
post 评论不需要帐户登录。
如何优化 MySQL CPU 利用率有时很高?
这是我的 my.ini 文件
slow-query-log=1
long_query_time=10
server-id=1
max_connections=2000
table_open_cache=2000
tmp_table_size=391M
thread_cache_size=10
key_buffer_size=512M
read_buffer_size=64K
read_rnd_buffer_size=256K
innodb_additional_mem_pool_size=32M
innodb_flush_log_at_trx_commit=2
innodb_log_buffer_size=256M
innodb_buffer_pool_size=10G
innodb_log_file_size=512M
innodb_thread_concurrency=25
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=256M
max_connect_errors=100
open_files_limit=4161
query_cache_type=1
sort_buffer_size=256K
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
query_cache_size = 2084M
请建议对此进行任何更改以降低 cpu 高利用率?
my.ini [mysqld] 部分的建议(RPS = 每秒速率)
您可以在以 root 身份登录后为您的 MySQL 版本验证这些动态全局变量功能:
设置全局variable_name=variable_value; (注意 128K 为 128*1024,391M 为 391*1024*1024 - K & M 不允许进行动态更改)
就在每天更换 my.ini 之前。如果您的请求被拒绝并显示 'read_only' 消息,请跳过它并告诉我。
# 20180904 1137 from mysqlservertuning.com
# read_rnd_buffer_size=128K # from 256K to reduce handler_read_rnd_next RPS
# innodb_io_capacity=1000 # from 200 to allow additional HD RD and WD RPS
# read_buffer_size=128K # from 64K to reduce handler_read_next RPS
# max_connections=1000 # from 2000 because max_used_connections in 2 days was 244
# thread_cache_size=100 # from 10 to conserve CPU and reduce threads_created of 339 in 2 days
# max_heap_table_size=391M # from 16M to be = tmp_table_size and reduce created_tmp_disk_tables count
# innodb_lru_scan_depth=100 # from 1024 to reduce CPU busy every second see refman
# key_buffer_size=64M # from 512M because only 11% used today
# innodb_change_buffer_max_size=15 # from 25 percent because less than 1% used
# innodb_flushing_avg_loops=10 # from 30 to reduce flushing loop delay
每一天,将您当前的 my.ini 保存在 \history 中,并使用 DATED 定时文件名,例如 20180904-1137-my.ini 以便快速返回上次工作 my.ini。
第一次,将此块(包括前导日期和我们的网站名称)复制到 [mysqld] 部分的末尾,并通过删除前导 # 和 space 字符启用每天一次更改,监控之前继续下一个更改。
禁用前导# 和 space 条的 EARLIER 相同命名变量,以避免混淆。在 5 年内,您仍然会有 my.ini 更改的历史记录以及大致日期。
通常每天只更改一次,在进行下一次更改之前进行监控。如果更改似乎有害,请回到上次工作 my.ini 并告诉我们。
期待您 post实施后进行审核 + 7 天 mysqlservertuning.com、select 购物,select 您购买的商品 - 即使它是免费的,请向下滚动到评论并添加您的评论。 post 评论不需要帐户登录。