MySQL中的信号灯锁导致停顿

时间:2018-09-11 08:29:45

标签: mysql

我在Ubuntu 16.04.1 LTS上使用5.7.16-10-log Percona Server,在AWS上使用m4.2xlarge ec2实例类型。

在过去的几个月中,我一直面临着信号等待的问题,该问题导致大约一分钟的停顿。这仅发生在上午10点至下午3点之间的每小时第二分钟。

mysql> show processlist 

在这段时间内,显示了庞大的查询列表,大约200-300个查询,在整个一分钟内都在等待。

Pastebin链接以获取完整的输出

mysql> SHOW ENGINE INNODB STATUS\G 

https://pastebin.com/ivehDxeT

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 1779463
--Thread 140348635367168 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349791127296 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349787133696 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349009938176 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348628977408 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140350206666496 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348644685568 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349784471296 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348620191488 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 3, waiters flag 0, lock_word: 1ffffffd
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349785003776 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348636964608 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
wait has ended
--Thread 140348634302208 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348625782528 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348996093696 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 3, waiters flag 0, lock_word: 1ffffffd
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348626315008 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348630841088 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348624185088 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348621788928 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349784205056 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 4, waiters flag 0, lock_word: 1ffffffc
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349793257216 has waited at btr0cur.cc line 3944 for 0.00 seconds the semaphore:
X-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349798848256 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349007808256 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349017659136 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349004613376 has waited at btr0sea.ic line 90 for 0.00 seconds the semaphore:
X-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 2, waiters flag 0, lock_word: 1ffffffe
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140349331310336 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 0, waiters flag 0, lock_word: 20000000
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348637763328 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 1, waiters flag 0, lock_word: 1fffffff
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
--Thread 140348638562048 has waited at btr0sea.ic line 128 for 0.00 seconds the semaphore:
S-lock on RW-latch at 0x36b2ca8 created in file btr0sea.cc line 230
number of readers 4, waiters flag 0, lock_word: 1ffffffc
Last time read locked in file btr0sea.ic line 128
Last time write locked in file /mnt/workspace/percona-server-5.7-debian-binary/label_exp/ubuntu-xenial-64bit/percona-server-5.7-5.7.16-10/storage/innobase/include/btr0sea.ic line 90
OS WAIT ARRAY INFO: signal count 80055845
RW-shared spins 0, rounds 19163955, OS waits 975752
RW-excl spins 0, rounds 47087597, OS waits 559240
RW-sx spins 600569, rounds 10520166, OS waits 115854
Spin rounds per wait: 19163955.00 RW-shared, 47087597.00 RW-excl, 17.52 RW-sx

我在最新的死锁部分中更改了表名,并删除了实际查询。

有什么方法可以识别导致这些等待的实际查询?

0 个答案:

没有答案