MySQL调整-有关实际配置的建议

时间:2019-02-07 10:36:49

标签: mysql my.cnf

大家好:)

我是为自己的数据库服务器寻找合适设置的众多尝试之一。

实际设置:

  • CPU:2.40GHz @ 12核Intel(R)Xeon(R)CPU E5-2640 v4
  • RAM:120 GB
  • 高清:3 TB
  • 并发连接:4.000
  • MySQL版本:5.7.25-来自Ubuntu存储库
  • 大量写入/更新负载

经过大量研究和计算,我制作了这个cnf,并想知道此设置是否可行,或者是否有可能对其进行改进。

非常感谢任何可以给我建议的人:)

祝你有美好的一天,

安东尼奥

我的CNF

[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir         = /usr
datadir = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking


key_buffer_size     = 384M
max_allowed_packet = 1024M
thread_cache_size   = 8

myisam-recover-options  = BACKUP



expire_logs_days        = 10
max_binlog_size         = 100M
innodb_file_per_table = 1
myisam_sort_buffer_size = 64M
read_rnd_buffer_size    = 8M
read_buffer_size        = 2M
sort_buffer_size        = 2M
table_open_cache = 512
max_connections = 5000
big-tables
default-storage-engine = InnoDB

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

log_error           = /var/log/mysql/error.log
general_log_file    = /var/log/mysql/mysql.log
general_log = 1
explicit_defaults_for_timestamp = ON
skip-name-resolve


lower_case_table_names = 1

innodb_lock_wait_timeout        = 3600
innodb_buffer_pool_size         = 18G
innodb_log_file_size            = 512M
innodb_flush_log_at_trx_commit  = 1
innodb_flush_method             = O_DIRECT

innodb_log_files_in_group       = 2
innodb_io_capacity              = 2000
innodb_read_io_threads          = 64
innodb_thread_concurrency       = 0

query_cache_type            = 0
query_cache_size            = 0
query_cache_limit           = 80M
query_cache_min_res_unit    = 2k


sysdate-is-now
transaction_isolation = READ-COMMITTED
large-pages

tmp_table_size                 = 32M
max_heap_table_size            = 32M
query_cache_type               = 1
thread_cache_size              = 907
open_files_limit               = 65535
table_definition_cache         = 4096

key_buffer_size = 32M
internal_tmp_disk_storage_engine = INNODB
innodb_table_locks = false
join_buffer_size = 64M
sort_buffer_size = 64M

slow_query_log_file = query-slow.log
long_query_time = 6

default_tmp_storage_engine = InnoDB

更新

感谢Wilson Hauck

MySqlTuner报告

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 12.2G (Tables: 112)
[OK] Total fragmented tables: 0


-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: OFF
[OK] No stat updates during querying INFORMATION_SCHEMA.


-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 1d 16h 39m 40s (9M q [64.577 qps], 3M conn, TX: 42G, RX: 2G)
[--] Reads / Writes: 17% / 83%
[--] Binary logging is disabled
[--] Physical Memory     : 118.0G
[--] Max MySQL memory    : 583.8G
[--] Other process memory: 0B
[--] Total buffers: 18.1G global + 138.2M per thread (4190 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 501.0G (424.60% of installed RAM)
[!!] Maximum possible memory usage: 583.8G (494.74% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (0/9M)
[OK] Highest usage of available connections: 85% (3577/4190)
[OK] Aborted connections: 0.52%  (20527/3943054)
[OK] Query cache is disabled by default due to mutex contention on multiprocessor machines.
[OK] Sorts requiring temporary tables: 8% (2K temp sorts / 31K sorts)
[!!] Joins performed without indexes: 556
[!!] Temporary tables created on disk: 80% (25K on disk / 31K total)
[OK] Thread cache hit rate: 99% (15K created / 3M connections)
[!!] Table cache hit rate: 1% (400 open / 27K opened)
[OK] Open file limit used: 0% (35/5K)
[OK] Table locks acquired immediately: 98% (15K immediate / 15K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.3% (6M used / 33M cache)
[OK] Key buffer size / total MyISAM indexes: 32.0M/51.0K
[OK] Read Key buffer hit rate: 98.7% (26K cached / 349 reads)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 18.0G/12.2G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (8.33333333333333 %): 768.0M * 2/18.0G should be equal 25%
[!!] InnoDB buffer pool instances: 8
[--] Number of InnoDB Buffer Pool Chunk : 144 for 8 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 100.00% (305237819690 hits/ 305238232833 total)
[!!] InnoDB Write Log efficiency: 49.83% (3588056 hits/ 7201295 total)
[OK] InnoDB log waits: 0.00% (0 waits / 3613239 writes)


-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Control warning line(s) into /var/log/mysql/error.log file
    Control error line(s) into /var/log/mysql/error.log file
    Restrict Host for user@% to user@SpecificDNSorIp
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Adjust your join queries to always utilize indexes
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: LINK
    Read this before increasing for MariaDB LINK
    This is MyISAM only table_cache scalability problem, InnoDB not affected.
    See more details here: https://bugs.mysql.com/bug.php?id=49177
    This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
    Beware that open_files_limit (5000) variable
    should be greater than table_open_cache (400)
    Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: LINK
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    join_buffer_size (> 64.0M, or always use indexes with JOINs)
    tmp_table_size (> 32M)
    max_heap_table_size (> 32M)
    table_open_cache (> 400)
    innodb_log_file_size should be (=2G) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
    innodb_buffer_pool_instances(=18)

Ulimit

Ulimit

IO-Stat

在空闲状态

iostat on idle time

正在加载

更新日期-2019-02-25

对不起,如果花了很多时间,就忙了:)

在实际配置中,mysql拥有cpu的195%

SHOW ENGINE INNODB状态

=====================================
INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 8 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1197466 srv_active, 0 srv_shutdown, 203085 srv_idle
srv_master_thread log flush and writes: 1400497
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 119792986
OS WAIT ARRAY INFO: signal count 5570632309
RW-shared spins 0, rounds 1367426132, OS waits 67501701
RW-excl spins 0, rounds 1021617577, OS waits 36318599
RW-sx spins 1673283, rounds 30481126, OS waits 422222
Spin rounds per wait: 1367426132.00 RW-shared, 1021617577.00 RW-excl, 18.22 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 106076139
Purge done for trx's n:o < 106066652 undo n:o < 0 state: running but idle
History list length 2418
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421181675097744, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675157544, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675109704, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675623064, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675465744, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675616624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675605584, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675552224, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675528304, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675174104, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675104184, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675175024, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675102344, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675098664, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421181675095904, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (read thread)
I/O thread 7 state: waiting for completed aio requests (read thread)
I/O thread 8 state: waiting for completed aio requests (read thread)
I/O thread 9 state: waiting for completed aio requests (read thread)
I/O thread 10 state: waiting for completed aio requests (read thread)
I/O thread 11 state: waiting for completed aio requests (read thread)
I/O thread 12 state: waiting for completed aio requests (read thread)
I/O thread 13 state: waiting for completed aio requests (read thread)
I/O thread 14 state: waiting for completed aio requests (read thread)
I/O thread 15 state: waiting for completed aio requests (read thread)
I/O thread 16 state: waiting for completed aio requests (read thread)
I/O thread 17 state: waiting for completed aio requests (read thread)
I/O thread 18 state: waiting for completed aio requests (read thread)
I/O thread 19 state: waiting for completed aio requests (read thread)
I/O thread 20 state: waiting for completed aio requests (read thread)
I/O thread 21 state: waiting for completed aio requests (read thread)
I/O thread 22 state: waiting for completed aio requests (read thread)
I/O thread 23 state: waiting for completed aio requests (read thread)
I/O thread 24 state: waiting for completed aio requests (read thread)
I/O thread 25 state: waiting for completed aio requests (read thread)
I/O thread 26 state: waiting for completed aio requests (read thread)
I/O thread 27 state: waiting for completed aio requests (read thread)
I/O thread 28 state: waiting for completed aio requests (read thread)
I/O thread 29 state: waiting for completed aio requests (read thread)
I/O thread 30 state: waiting for completed aio requests (read thread)
I/O thread 31 state: waiting for completed aio requests (read thread)
I/O thread 32 state: waiting for completed aio requests (read thread)
I/O thread 33 state: waiting for completed aio requests (read thread)
I/O thread 34 state: waiting for completed aio requests (read thread)
I/O thread 35 state: waiting for completed aio requests (read thread)
I/O thread 36 state: waiting for completed aio requests (read thread)
I/O thread 37 state: waiting for completed aio requests (read thread)
I/O thread 38 state: waiting for completed aio requests (read thread)
I/O thread 39 state: waiting for completed aio requests (read thread)
I/O thread 40 state: waiting for completed aio requests (read thread)
I/O thread 41 state: waiting for completed aio requests (read thread)
I/O thread 42 state: waiting for completed aio requests (read thread)
I/O thread 43 state: waiting for completed aio requests (read thread)
I/O thread 44 state: waiting for completed aio requests (read thread)
I/O thread 45 state: waiting for completed aio requests (read thread)
I/O thread 46 state: waiting for completed aio requests (read thread)
I/O thread 47 state: waiting for completed aio requests (read thread)
I/O thread 48 state: waiting for completed aio requests (read thread)
I/O thread 49 state: waiting for completed aio requests (read thread)
I/O thread 50 state: waiting for completed aio requests (read thread)
I/O thread 51 state: waiting for completed aio requests (read thread)
I/O thread 52 state: waiting for completed aio requests (read thread)
I/O thread 53 state: waiting for completed aio requests (read thread)
I/O thread 54 state: waiting for completed aio requests (read thread)
I/O thread 55 state: waiting for completed aio requests (read thread)
I/O thread 56 state: waiting for completed aio requests (read thread)
I/O thread 57 state: waiting for completed aio requests (read thread)
I/O thread 58 state: waiting for completed aio requests (read thread)
I/O thread 59 state: waiting for completed aio requests (read thread)
I/O thread 60 state: waiting for completed aio requests (read thread)
I/O thread 61 state: waiting for completed aio requests (read thread)
I/O thread 62 state: waiting for completed aio requests (read thread)
I/O thread 63 state: waiting for completed aio requests (read thread)
I/O thread 64 state: waiting for completed aio requests (read thread)
I/O thread 65 state: waiting for completed aio requests (read thread)
I/O thread 66 state: waiting for completed aio requests (write thread)
I/O thread 67 state: waiting for completed aio requests (write thread)
I/O thread 68 state: waiting for completed aio requests (write thread)
I/O thread 69 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
749107 OS file reads, 41945849 OS file writes, 37709098 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 46.42 writes/s, 46.42 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 38, seg size 40, 1824 merges
merged operations:
insert 2766, delete mark 3, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 19122557, node heap has 1995 buffer(s)
Hash table size 19122557, node heap has 33 buffer(s)
Hash table size 19122557, node heap has 741 buffer(s)
Hash table size 19122557, node heap has 51 buffer(s)
Hash table size 19122557, node heap has 5 buffer(s)
Hash table size 19122557, node heap has 143103 buffer(s)
Hash table size 19122557, node heap has 7260 buffer(s)
Hash table size 19122557, node heap has 74 buffer(s)
1243151.23 hash searches/s, 51070.99 non-hash searches/s
---
LOG
---
Log sequence number 78369175008
Log flushed up to   78369175008
Pages flushed up to 78228581012
Last checkpoint at  78228581012
0 pending log flushes, 0 pending chkp writes
35560358 log i/o's done, 46.43 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 79159099392
Dictionary memory allocated 892048
Buffer pool size   4718016
Free buffers       2934316
Database pages     1630438
Old database pages 601698
Modified db pages  8930
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 174356, not young 417331
0.00 youngs/s, 0.00 non-youngs/s
Pages read 715795, created 914663, written 5423919
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 1630438, unzip_LRU len: 0
I/O sum[584]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size   589752
Free buffers       367176
Database pages     203393
Old database pages 75060
Modified db pages  1500
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 171, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 90666, created 112727, written 937610
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 203393, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size   589752
Free buffers       366540
Database pages     204030
Old database pages 75295
Modified db pages  787
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 216, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 89925, created 114105, written 419792
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 204030, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size   589752
Free buffers       367089
Database pages     203549
Old database pages 75118
Modified db pages  1019
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 108, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 88870, created 114679, written 576213
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 203549, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size   589752
Free buffers       365729
Database pages     204885
Old database pages 75611
Modified db pages  1143
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 86765, not young 279135
0.00 youngs/s, 0.00 non-youngs/s
Pages read 89974, created 114916, written 841103
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 204885, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 4
Buffer pool size   589752
Free buffers       369716
Database pages     200894
Old database pages 74138
Modified db pages  1228
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 109, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 87043, created 113851, written 681003
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 200894, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 5
Buffer pool size   589752
Free buffers       365471
Database pages     205150
Old database pages 75709
Modified db pages  1305
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 86566, not young 138196
0.00 youngs/s, 0.00 non-youngs/s
Pages read 90321, created 114844, written 660036
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 205150, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 6
Buffer pool size   589752
Free buffers       366191
Database pages     204366
Old database pages 75420
Modified db pages  896
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 205, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 89258, created 115108, written 700593
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 204366, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 7
Buffer pool size   589752
Free buffers       366404
Database pages     204171
Old database pages 75347
Modified db pages  1052
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 216, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 89738, created 114433, written 607569
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 204171, unzip_LRU len: 0
I/O sum[73]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
4 queries inside InnoDB, 0 queries in queue
4 read views open inside InnoDB
Process ID=109061, Main thread ID=139625998640896, state: sleeping
Number of rows inserted 195303682, updated 12860884573, deleted 8878743, read 1235281078969
438.07 inserts/s, 6876.89 updates/s, 0.00 deletes/s, 1347118.99 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 个答案:

答案 0 :(得分:2)

每秒速率= RPS-有关my.cnf [mysqld]部分的建议

general_log=0  # from 1 - turn ON, only WHEN NEEDED and turn OFF ASAP.
read_rnd_buffer_size=256K  # from 8M to reduce handler_read_rnd_next RPS
read_buffer_size=1M  # from 2M to conserve RAM
innodb_lru_scan_depth=100  # from 1024 to reduce CPU cycles used every SECOND
query_cache_type=0  # from 1 for OFF, since you are NOT using QC, conserve CPU
thread_cache_size=256  # from 907 to reduce mgmt overhead for more reasonable size
sort_buffer_size=2M  # from 64M to reduce per connection RAM requests
join_buffer_size=6M  # from 64M to reduce per connection RAM requests
table_open_cache=4000  # from 400 to reduce opened_tables RPS

您目前的innodb_buffer_pool_size为18G,这对于您的12GB数据来说是合理的,并且有足够的空间来支持其他数据,然后才需要扩展。

在OS命令提示符下, ulimit -n 65536将动态启用更多打开文件