关于 MySQL 的一个问题,希望得到排查思路

2023-09-12 16:51:03 +08:00
 cmai

当我在并行执行几个复杂的视图的时候,mysql 整个库都会陷入到卡死的状态,所有的表都打不开,可以从哪方面排查呢?

2731 次点击
所在节点    MySQL
34 条回复
voidmnwzp
2023-09-13 05:01:21 +08:00
换 oracle
ericguo
2023-09-13 07:38:42 +08:00
可以先升级到 5.7.44 看看。看起来像 bug https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
ccde8259
2023-09-13 07:45:52 +08:00
@cmai 别用 Ceph 这类块存储延迟表现极其差劲……
zoharSoul
2023-09-13 10:03:04 +08:00
不要用视图
cmai
2023-09-13 10:23:19 +08:00
@zoharSoul 旧系统的改造,没法约束
cmai
2023-09-13 10:28:56 +08:00
@yinmin 好的,我会关注下这个问题,其实出现问题的第一时间就怀疑是磁盘的问题了, 但是做存储这块的同学很肯定的告诉我不是磁盘的问题 0.0 , 给我了一份测试报告





2G 文件 ,4K 随机读,10 线程,异步,磁盘测试,IOPS=73.6K
Starting 10 threads
Jobs: 10 (f=10): [r(10)][100.0%][r=338MiB/s,w=0KiB/s][r=86.6k,w=0 IOPS][eta 00m:00s]
mytest: (groupid=0, jobs=10): err= 0: pid=3370: Mon Sep 11 09:36:20 2023
read: IOPS=73.6k, BW=288MiB/s (302MB/s)(16.9GiB/60001msec)
clat (nsec): min=733, max=122800k, avg=133663.23, stdev=560820.67
lat (nsec): min=761, max=122801k, avg=133786.51, stdev=560824.85
clat percentiles (nsec):
| 1.00th=[ 1464], 5.00th=[ 2024], 10.00th=[ 2416],
| 20.00th=[ 2960], 30.00th=[ 3440], 40.00th=[ 3888],
| 50.00th=[ 4320], 60.00th=[ 4896], 70.00th=[ 5600],
| 80.00th=[ 6944], 90.00th=[ 544768], 95.00th=[ 946176],
| 99.00th=[ 1843200], 99.50th=[ 2605056], 99.90th=[ 6258688],
| 99.95th=[ 8159232], 99.99th=[13565952]
bw ( KiB/s): min= 2336, max=51544, per=9.98%, avg=29408.46, stdev=6697.04, samples=1193
iops : min= 584, max=12886, avg=7352.08, stdev=1674.25, samples=1193
lat (nsec) : 750=0.01%, 1000=0.10%
lat (usec) : 2=4.59%, 4=37.73%, 10=43.12%, 20=2.04%, 50=0.68%
lat (usec) : 100=0.12%, 250=0.02%, 500=1.19%, 750=2.96%, 1000=3.03%
lat (msec) : 2=3.59%, 4=0.59%, 10=0.21%, 20=0.03%, 50=0.01%
lat (msec) : 100=0.01%, 250=0.01%
cpu : usr=1.78%, sys=5.45%, ctx=519504, majf=0, minf=3494
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=4418208,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=288MiB/s (302MB/s), 288MiB/s-288MiB/s (302MB/s-302MB/s), io=16.9GiB (18.1GB), run=60001-60001msec
Disk stats (read/write):
rbd24: ios=511432/6, merge=0/2, ticks=541535/21, in_queue=256375, util=99.84%
cmai
2023-09-13 10:29:58 +08:00
@yinmin 调整 limit 这个我等下会尝试下,有结果了来这里回复,哈哈
hefish
2023-09-13 10:48:34 +08:00
这磁盘的 read 小了点啊。
Znemo
2023-09-13 11:34:40 +08:00
连接因为某种原因断开了,查询的时候在重连。
cmai
2023-09-13 14:35:32 +08:00
@Znemo 啊,这是怎么看出来的
realpg
2023-09-13 19:32:49 +08:00
@cmai #30
知道你问题解决了
但是,视图赶紧全删了……
Znemo
2023-09-13 20:46:59 +08:00
@cmai innodb_thread_concurrency 这是怎么看出来的
cmai
2023-09-14 10:08:50 +08:00
@realpg 没办法,不是我写的, 虽然我也很想删掉他,我们制定的使用标准已经回收了视图和存储过程的权限, 这个 mysql 是从旧的虚拟机上迁移到容器里, 业务组不改我们也只能迁就
cmai
2023-09-14 10:10:00 +08:00
@Znemo try try see , 试出来的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.fyfyfm.apispeedy.workers.dev/t/973081

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX