您好,登錄后才能下訂單哦!
下文主要給大家?guī)韚buntu mysql5.6 占用CPU過高以致機(jī)器卡死該怎么處理,希望這些內(nèi)容能夠帶給大家實(shí)際用處,這也是我編輯ubuntu mysql5.6 占用CPU過高以致機(jī)器卡死該怎么處理這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。
第一步,找出宕機(jī)半個小時之內(nèi)的CPU,內(nèi)存,網(wǎng)絡(luò)等檢測數(shù)據(jù)!檢測結(jié)果是這樣的:
從上面四個圖可以看出,內(nèi)存和網(wǎng)絡(luò)正常,只有CPU從13:50開始一直使用過高,突然增長到90%!
由此分析出
原因一,Query查詢響應(yīng)過慢,也就是個別查詢占用時間太長。
原因二,磁盤出問題
或許還有其他原因,目前還沒經(jīng)驗(yàn)分析出來
第二步,我接到電話后趕緊在附近找了一個商務(wù)中心,借了一臺電腦,登陸到了首都在線的云端,查看mysql數(shù)據(jù)庫機(jī)器的日志,昨天13:50左右出現(xiàn)了這樣一段日志:
InnoDB: Warning: a long semaphore wait: --Thread 140157120059136 has waited at lock0lock.cc line 6837 for 289.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 InnoDB: Warning: a long semaphore wait: --Thread 140157120661248 has waited at trx0trx.cc line 1195 for 290.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: Warning: a long semaphore wait: --Thread 140161374390016 has waited at trx0sys.ic line 431 for 290.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: Warning: a long semaphore wait: --Thread 140161383220992 has waited at trx0trx.cc line 193 for 272.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: Warning: a long semaphore wait: --Thread 140161379407616 has waited at trx0trx.cc line 863 for 271.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: Warning: a long semaphore wait: --Thread 140157120259840 has waited at trx0trx.cc line 2013 for 270.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: Warning: a long semaphore wait: --Thread 140161431643904 has waited at lock0lock.cc line 6837 for 270.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 InnoDB: Warning: a long semaphore wait: --Thread 140161432647424 has waited at trx0trx.cc line 863 for 262.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: ###### Starts InnoDB Monitor for 30 secs to print diagnostic info: InnoDB: Pending preads 0, pwrites 1 ===================================== 2016-05-01 13:51:01 7f79e4b4b700 INNODB MONITOR OUTPUT ===================================== Per second averages calculated from the last 68 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 11249 srv_active, 0 srv_shutdown, 208673 srv_idle srv_master_thread log flush and writes: 219885 ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 37569 --Thread 140161388840704 has waited at trx0rec.cc line 1295 for 0.00 seconds the semaphore: X-lock (wait_ex) on RW-latch at 0x7f7a246dadc0 created in file buf0buf.cc line 1069 a writer (thread id 140161388840704) has reserved it in mode wait exclusive number of readers 1, waiters flag 0, lock_word: ffffffffffffffff Last time read locked in file buf0flu.cc line 1056 Last time write locked in file /usr/local/src/mysql-5.6.27/storage/innobase/trx/trx0rec.cc line 1295 wait has ended --Thread 140161446295296 has waited at lock0lock.cc line 6837 for 36.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140157129492224 has waited at trx0trx.cc line 193 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157119256320 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157121464064 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161369372416 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161394259712 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157125478144 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161371780864 has waited at trx0trx.cc line 1195 for 36.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161521604352 has waited at lock0wait.cc line 510 for 52.00 seconds the semaphore: Mutex at 0x7f79ec4570c8 created file lock0lock.cc line 614, lock var 1 waiters flag 1 --Thread 140157123069696 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157119055616 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161397470976 has waited at lock0lock.cc line 5946 for 36.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140157121865472 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161375393536 has waited at trx0trx.cc line 863 for 43.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161380009728 has waited at lock0lock.cc line 6837 for 36.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161435457280 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157119457024 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161370375936 has waited at trx0trx.cc line 193 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157121664768 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161430038272 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161449305856 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161394861824 has waited at trx0trx.cc line 1195 for 37.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 InnoDB: ###### Diagnostic info printed to the standard error stream --Thread 140157126481664 has waited at lock0lock.cc line 6837 for 37.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140157119657728 has waited at trx0sys.ic line 431 for 37.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157118453504 has waited at trx0trx.cc line 863 for 37.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157118854912 has waited at lock0lock.cc line 6837 for 37.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161388439296 has waited at trx0trx.cc line 2013 for 37.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161445693184 has waited at lock0lock.cc line 4416 for 37.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161441879808 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140157122066176 has waited at trx0trx.cc line 863 for 53.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161431643904 has waited at trx0trx.cc line 1195 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161426425600 has waited at lock0lock.cc line 6837 for 37.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161432848128 has waited at trx0trx.cc line 1195 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161379206912 has waited at trx0trx.cc line 1195 for 37.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161496426240 has waited at read0read.cc line 414 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161383220992 has waited at trx0rec.cc line 1457 for 49.00 seconds the semaphore: S-lock on RW-latch at 0xd1d3278 created in file trx0purge.cc line 128 a writer (thread id 140161496426240) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock_word: 0 Last time read locked in file trx0rec.cc line 1457 Last time write locked in file /usr/local/src/mysql-5.6.27/storage/innobase/trx/trx0purge.cc line 1197 --Thread 140161374390016 has waited at lock0wait.cc line 95 for 36.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161381816064 has waited at lock0lock.cc line 6837 for 36.00 seconds the semaphore: Mutex at 0x7f79ec457078 created file lock0lock.cc line 611, lock var 1 waiters flag 1 --Thread 140161441478400 has waited at trx0rec.cc line 1457 for 56.00 seconds the semaphore: S-lock on RW-latch at 0xd1d3278 created in file trx0purge.cc line 128 a writer (thread id 140161496426240) has reserved it in mode exclusive number of readers 0, waiters flag 1, lock_word: 0 Last time read locked in file trx0rec.cc line 1457 Last time write locked in file /usr/local/src/mysql-5.6.27/storage/innobase/trx/trx0purge.cc line 1197 --Thread 140161432647424 has waited at trx0trx.cc line 863 for 56.00 seconds the semaphore: Mutex at 0xd1c60f8 created file trx0sys.cc line 597, lock var 0 waiters flag 0 --Thread 140161529997056 has waited at log0log.cc line 2159 for 49.00 seconds the semaphore: S-lock on RW-latch at 0xd1be058 created in file log0log.cc line 907 number of readers 0, waiters flag 0, lock_word: 100000 Last time read locked in file log0log.cc line 2159 Last time write locked in file /usr/local/src/mysql-5.6.27/storage/innobase/log/log0log.cc line 1944 OS WAIT ARRAY INFO: signal count 78027 Mutex spin waits 203541, rounds 135641, OS waits 1189 RW-shared spins 64274, rounds 1104435, OS waits 34133 RW-excl spins 38583, rounds 268488, OS waits 2065 Spin rounds per wait: 0.67 mutex, 17.18 RW-shared, 6.96 RW-excl FAIL TO OBTAIN LOCK MUTEX, SKIP LOCK INFO PRINTING -------- FILE I/O -------- I/O thread 0 state: waiting for i/o request (insert buffer thread) I/O thread 1 state: waiting for i/o request (log thread) I/O thread 2 state: waiting for i/o request (read thread) I/O thread 3 state: waiting for i/o request (read thread) I/O thread 4 state: waiting for i/o request (read thread) I/O thread 5 state: waiting for i/o request (read thread) I/O thread 6 state: complete io for buf page (write thread) ev set I/O thread 7 state: waiting for i/o request (write thread) I/O thread 8 state: waiting for i/o request (write thread) I/O thread 9 state: waiting for i/o request (write thread) Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 1 116146 OS file reads, 287569 OS file writes, 176487 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.30 writes/s, 0.17 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX ------------------------------------- Ibuf: size 1, free list len 14, seg size 16, 20355 merges merged operations: insert 23246, delete mark 0, delete 0 discarded operations: insert 0, delete mark 0, delete 0 Hash table size 12749851, node heap has 3154 buffer(s) 527.29 hash searches/s, 35.50 non-hash searches/s --- LOG --- Log sequence number 12608071674 Log flushed up to 12608071674 Pages flushed up to 12608062434 Last checkpoint at 12608062035 0 pending log writes, 0 pending chkp writes 38319 log i/o's done, 0.03 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 6593445888; in additional pool allocated 0 Dictionary memory allocated 2835498 Buffer pool size 393212 Free buffers 262259 Database pages 127799 Old database pages 47258 Modified db pages 15 Pending reads 0 Pending writes: LRU 0, flush list 3, single page 0 Pages made young 36, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 124071, created 3728, written 229860 0.00 reads/s, 0.00 creates/s, 0.27 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: 127799, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---------------------- INDIVIDUAL BUFFER POOL INFO ---------------------- ---BUFFER POOL 0 Buffer pool size 49152 Free buffers 32497 Database pages 16268 Old database pages 6020 Modified db pages 4 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 4, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15847, created 421, written 37802 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: 16268, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 1 Buffer pool size 49151 Free buffers 32784 Database pages 15965 Old database pages 5913 Modified db pages 2 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 5, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15489, created 476, written 26109 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: 15965, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 2 Buffer pool size 49152 Free buffers 33272 Database pages 15486 Old database pages 5736 Modified db pages 1 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 2, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15161, created 325, written 23667 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: 15486, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 3 Buffer pool size 49151 Free buffers 32607 Database pages 16140 Old database pages 5975 Modified db pages 2 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 3, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15684, created 456, written 31295 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: 16140, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 4 Buffer pool size 49152 Free buffers 32504 Database pages 16250 Old database pages 6002 Modified db pages 1 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 8, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15740, created 510, written 32564 0.00 reads/s, 0.00 creates/s, 0.05 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: 16250, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 5 Buffer pool size 49151 Free buffers 32925 Database pages 15839 Old database pages 5847 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 5, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15239, created 600, written 27844 0.00 reads/s, 0.00 creates/s, 0.10 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: 15839, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 6 Buffer pool size 49152 Free buffers 33046 Database pages 15718 Old database pages 5790 Modified db pages 2 Pending reads 0 Pending writes: LRU 0, flush list 0, single page 0 Pages made young 5, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15179, created 539, written 24954 0.00 reads/s, 0.00 creates/s, 0.08 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: 15718, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] ---BUFFER POOL 7 Buffer pool size 49151 Free buffers 32624 Database pages 16133 Old database pages 5975 Modified db pages 3 Pending reads 0 Pending writes: LRU 0, flush list 3, single page 0 Pages made young 4, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 15732, created 401, written 25625 0.00 reads/s, 0.00 creates/s, 0.05 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: 16133, unzip_LRU len: 0 I/O sum[0]:cur[0], unzip sum[0]:cur[0] -------------- ROW OPERATIONS -------------- 0 queries inside InnoDB, 0 queries in queue 61 read views open inside InnoDB Main thread process no. 17977, id 140161529997056, state: making checkpoint Number of rows inserted 147712, updated 47959, deleted 89012, read 2163996308 0.03 inserts/s, 0.00 updates/s, 0.00 deletes/s, 2529.48 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================
從上面日志能分析,原來linux內(nèi)核信號量默認(rèn)設(shè)置太小,并發(fā)高的時候,造成大量等待,
默認(rèn)
# cat /proc/sys/kernel/sem
250 32000 32 128
信號量:
當(dāng)前系統(tǒng)信號量限制:
# ipcs -ls
—— Semaphore Limits ——–
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
SEMMSL
含義:每個信號量set中信號量最大個數(shù)
設(shè)置:最小250;對于processes參數(shù)設(shè)置較大的系統(tǒng)建議設(shè)置為processes+10
SEMMNI
含義:linux系統(tǒng)信號量set最大個數(shù)
設(shè)置:最少128
SEMMNS
含義:linux系統(tǒng)中信號量最大個數(shù)
設(shè)置:至少32000;SEMMSL * SEMMNI
SEMOPM
含義:semop系統(tǒng)調(diào)用允許的信號量最大個數(shù)
設(shè)置:至少100;或者等于SEMMSL
查看信號量設(shè)置:cat /proc/sys/kernel/sem
order:SEMMSL, SEMMNS, SEMOPM, SEMMNI
# cat /proc/sys/kernel/sem
250 32000 100 128
修改:
sysctl -w kernel.sem="250 32000 100 128"
echo "kernel.sem=250 32000 100 128">> /etc/sysctl.conf
手動改變了信號量大小可以初步解決問題!我再仔細(xì)分析了一下日志:其中一段如下:
OS WAIT ARRAY INFO: signal count
78027
Mutex spin waits
203541
, rounds
135641
, OS waits
1189
RW-shared spins
64274
, rounds
1104435
, OS waits
34133
RW-excl spins
38583
, rounds
268488
, OS waits
2065
Spin rounds per wait:
0.67
mutex,
17.18
RW-shared,
6.96
RW-excl
FAIL TO OBTAIN LOCK MUTEX, SKIP LOCK INFO PRINTING
發(fā)現(xiàn)spin waits和OS waits等待時間相當(dāng)高,在手冊里查到了這一句話:
You can monitor the
use
of the adaptive hash index and the contention
for
its
use
in
the SEMAPHORES section of the output of the SHOW ENGINE INNODB STATUS command. If you see many threads waiting on an RW-latch created
in
btr0sea.c, then it might be useful to disable adaptive hash indexing.
Sometimes, the read/write lock that guards access to the adaptive hash index can become a source of contention under heavy workloads, such
as
multiple concurrent joins.
由于自適應(yīng)哈希索引造成大量的鎖爭用,進(jìn)而堵塞很多進(jìn)程,最終導(dǎo)致MySQL崩潰重啟
找到原因后,關(guān)閉了自適應(yīng)哈希索引,觀察了一天后(參考性能圖1月1日),spin waits和OS waits等待時間逐漸減少。
set
global
innodb_adaptive_hash_index = 0;
對于以上關(guān)于ubuntu mysql5.6 占用CPU過高以致機(jī)器卡死該怎么處理,大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會喜歡上這些內(nèi)容的。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。