20240509线上问题排查

iotop -oP
pidstat -d 1
mpstat -P ALL 5
cat /proc/*/status|grep -E 'State:.*Z.*|State:.*D.*' -A 10 -B 2  
top
https://blog.csdn.net/chrisy521/article/details/128532234
db.system.profile.find({"millis":{$gte:500}}).limit(10).sort( { ts : -1 } ).pretty()



/qaxdata/s/services/mongo/27017/bin/mongostat --uri=$(/qaxdata/s/services/etcd/etcd_2483/bin/etcdctl --endpoints=127.0.0.1:2483 get --prefix=true da.xian.test|egrep "mongo:\/\/"|tail -n 1|sed 's#^mongo://#mongodb://#g'|sed 's/\(.*\?\)?.*/\1\?replicaset=mongorepl\&authSource=admin/g')


大页
https://blog.csdn.net/liu16659/article/details/80942461

page cache
https://blog.whysdomain.com/blog/360/

脏页和numa
https://github.com/moooofly/MarkSomethingDown/blob/master/Linux/CPU%20%E9%9A%94%E7%A6%BB%E4%B9%8B%20numactl.md
https://blog.51cto.com/u_13527/8131679
https://github.com/plantegg/programmer_case/blob/main/CPU/十年后数据库还是不敢拥抱NUMA.md

mongo优化方向
https://juejin.cn/post/7345300528703012901


硬件优化
https://docs.openeuler.org/zh/docs/22.09/docs/SystemOptimization/大数据调优指南.html

大页和验证大页使用情况
https://help.aliyun.com/zh/ecs/transparent-huge-page-thp-related-performance-optimization-in-alibaba-cloud-linux-2

脏页
https://zhuanlan.zhihu.com/p/355131426

采集io相关数据
sar -B 1
https://blog.haohtml.com/archives/14760/
https://blog.whysdomain.com/blog/360/

pgscank/s: kswapd(后台回收线程) 每秒扫描的page个数
pgscand/s: 应用程序在内存申请过程中每秒直接扫描的page个数
pgsteal/s: 扫描的page中每秒被回收的个数
%vmeff: pgsteal/(pgscank+pgscand), 回收效率,越接近100说明系统越安全,越接近0说明系统内存压力越大。
majflt/s: 这个数值增长一般说明需要进行i/o操作,所需的内存页不在主存中,需要与磁盘或者swap分区交互.

https://blog.haohtml.com/archives/14760/
https://www.jianshu.com/p/3991c0dba094
https://xujinzh.github.io/2022/03/30/linux-hard-disk-read-write-statistics/index.html

# pidstat -u -r -d -t 1        
# -u CPU 使用率
# -r 缺页及内存信息
# -d IO 信息
# -t 以线程为统计单位
# 1  1 秒统计一次

[root@xxxx_wan360_game ~]# pidstat -u -r -d -t 1

https://jaminzhang.github.io/os/Linux-IO-Monitoring-and-Deep-Analysis/

重点

https://blog.whysdomain.com/blog/360/

https://zhuanlan.zhihu.com/p/343661117

https://github.com/plantegg/programmer_case/blob/main/CPU/十年后数据库还是不敢拥抱NUMA.md

https://zhuanlan.zhihu.com/p/458308735

http://www.anger6.com/2022/01/17/high_performance/性能分析---内存篇page_fault/

https://blog.haohtml.com/archives/14760/

https://ivanzz1001.github.io/records/post/linuxops/2017/11/19/linux-performance-debug

  • minflt/s: 指的是minor faults,当需要访问的物理页面因为某些原因(比如共享页面、缓存机制)已经存在于物理内存中了,只是在当前进程的页表中没有引用,MMU只需要设置对应的entry就可以了,这个代价是相当小的。

  • majflt/s: 指的是major faults,MMU需要在当前可用物理内存中申请一块空闲的物理页面(如果没有可用的空闲页面,则需要将别的物理页面切换到交换空间去以释放得到空闲物理页面),然后从外部加载数据到该物理页面中,并设置好对应的entry,这个代价是相当高的,和前者有几个数据级的差异。

posted on 2024-05-09 17:45  吃草的青蛙  阅读(4)  评论(0编辑  收藏  举报

导航