This commit is contained in:
marsal
2025-08-21 18:57:57 +08:00
parent bdd2b461dc
commit 984fa247d7
13 changed files with 434 additions and 66 deletions

36
运维/my.cnf Normal file
View File

@ -0,0 +1,36 @@
[mysqld]
# 内存核心配置 (适配64GB内存)
innodb_buffer_pool_size = 44G # 提升至物理内存的68%
innodb_buffer_pool_instances = 16 # 匹配CPU核心数
# 线程与连接优化 (适配281连接/64核心)
thread_cache_size = 150 # 调整为连接数的一半
innodb_thread_concurrency = 0 # 禁用并发限制让MySQL自动管理
innodb_read_io_threads = 16
innodb_write_io_threads = 16
# 每连接内存优化 (关键!)
max_connections = 400
sort_buffer_size = 512K # 原256K过低
read_buffer_size = 256K
read_rnd_buffer_size = 512K
join_buffer_size = 512K
thread_stack = 512K # 防止复杂查询溢出
# 临时表与缓存优化
tmp_table_size = 128M
max_heap_table_size = 128M
table_open_cache = 10000
table_definition_cache = 4000
# InnoDB日志优化 (SSD专用)
innodb_log_file_size = 4G # 增大日志文件
innodb_log_files_in_group = 2 # 共8GB日志
innodb_io_capacity = 20000 # SSD优化
innodb_io_capacity_max = 40000
innodb_flush_method = O_DIRECT_NO_FSYNC
# 超时与维护
wait_timeout = 120
interactive_timeout = 300
innodb_purge_threads = 4