当前位置:网站首页>How to check if the online query suddenly slows down
How to check if the online query suddenly slows down
2022-08-11 00:21:00 【Wandering about the cat】
目录
Update the same data in parallel
系统架构
- 网络
- Competition for middleware
- The backend service itself is slow
- 竞争DB本身
- DB查询慢
网络层面
网络丢包,重传
If dual data centers are involved,Or multi-center office scenarios,就会有这种情况.
可以长时间ping测试丢包情况.
网卡满 比如大字段
使用dstatCommand to test network congestion
网络链路变长
Involves system integration,old system involved,This type of problem can be caused if the link length is called.
如果有catThis type of distributed link tracking system,可以看,Otherwise, it's not very easy to do
受到IO影响
如果数据库服务 There may be disks caused by backup servicesIO,CPU,内存被大量占用,导致查询变慢.The essence is that other services are occupied“主服务”资源导致.
If the backend service writes files in large batches, it will cause the diskIO抢占,cause slow operation
核查:
- 使用top检查CPU,memory consuming process
- 如果是后端服务,Query the memory usage of threads,top -Hp PID
- 用linux dstat验证IO读写情况
CPU/MEM
CPU和内存 It is usually caused by other services being occupied
服务
资源抢占
比如redis锁,DB连接 等.If this type of concurrency is high, a large number of threads will be in a waiting state.
检查:
- jstack 输出java栈
- jmap dump快照,使用jvisualvm,jprofiler,mat等工具分析
FullGc
频繁FullGCIt will cause service lag,CPU占有率升高
检查:
- 用jstat -gcutil pid 查看gc数量和时间
- 使用dump文件分析 可能的内存泄露
数据库
没有走索引
As the database grows,If it happens that a query condition does not go through the index,查询会比较慢.
检查:
- 查看慢sql
- 查看执行计划explain
Update the same data in parallel
常见的秒杀场景:数据库并发执行update,更新同一行的动作会被其他已经持有锁的会话堵住,并且需要要进行判断会不会由于自己的加入导致死锁
数据分布不均
a=11,10条数据
a=21,10W数据,Queries are naturally different
Inappropriate query
select *** from tt limit 10000000,10;
This kind needs to be found first10000000条,然后往后找10条
调整为:
select * from tt where id >= 10 limit 10;
表设计有问题
varchar(2000) text
调整:
- 纵向拆分,将varchar 2000 This field is split into another table
innodb 刷脏页
InnoDB引擎采用Write Ahead Log(WAL)策略,即事务提交时,先写日志(redo log),再写磁盘.为了提高IO效率,在写日志的时候会先写buffer,然后集中flush buffer pool 到磁盘. 这个过程 We call it dirtying pages.
这个过程中就有可能导致平时执行很快的SQL突然变慢.
边栏推荐
猜你喜欢
Web-based meal ordering system in epidemic quarantine area
EPro-PnP: Generalized End-to-End Probabilistic Perspective-n-Points for Monocular Object Pose Est...
YOLOv5的Tricks | 【Trick13】YOLOv5的detect.py脚本的解析与简化
如何破坏Excel文件,让其显示文件已损坏方法
“蔚来杯“2022牛客暑期多校训练营2 DGHJKL题解
“蔚来杯“2022牛客暑期多校训练营3 DF题解
13. Content Negotiation
报错:Client does not support authentication protocol requested by server; consider upgrading MySQL cli
鲲鹏编译调试及原生开发工具基础知识
深度解析volatile关键字(保证够全面)
随机推荐
虚拟电厂可视化大屏,深挖痛点精准减碳
给肯德基打工的调料商,年赚两亿
盘点美军的无人机家底
16. 文件上传
复制带随机指针的链表——LeetCode
Dump file generation, content, and analysis
input输入框超出部分用省略号表示以及判断内容是否有超出(PC端)
微信小程序自定义navigationBar
"NIO Cup" 2022 Nioke Summer Multi-School Training Camp 3 DF Problem Solving
线上突然查询变慢怎么核查
web 性能提升(将持续更新……)
Kunpeng compilation and debugging and basic knowledge of native development tools
全排列思路详解
Navicat 16-数据库工具
百战RHCE(第四十八战:运维工程师必会技-Ansible学习3-构建Ansible清单)
2. Dependency management and automatic configuration
如何破坏Excel文件,让其显示文件已损坏方法
@Autowired注入RedisCache报错空指针
App regression testing, what are the efficient testing methods?
Only lazy and hungry. You still don't understand the singleton pattern!