Linux基础
1 前言
一个问题,一篇文章,一出故事。
今天发现某台服务器反应很慢,于是展开调查。最后发现是僵尸进程数和睡眠进程数异常。于是记录排查过程。
2 最佳实践
2.1 检查进程数
top
可见如下显示,
top - 09:31:39 up 151 days, 21:14, 3 users, load average: 13932.35, 13932.39, 13931.75 Tasks: 14635 total, 1 running, 14498 sleeping, 0 stopped, 13600 zombie %Cpu(s): 3.1 us, 5.5 sy, 0.0 ni, 91.1 id, 0.0 wa, 0.0 hi, 0.3 si, 0.0 st KiB Mem : 66057148 total, 35949704 free, 19300004 used, 10807440 buff/cache KiB Swap: 2097148 total, 376756 free, 1720392 used. 41184232 avail Mem
以上我们注意到,以下属于异常行为,
– 选项“zombie”的进程数是“13600”
– 选项“sleeping”的进程数是“14498”
2.2 列出僵尸进程
ps aux | grep Z
可见如下输出,
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2891 0.0 0.0 0 0 ? Zs Sep10 0:00 [bash] root 3285 0.0 0.0 0 0 ? Zs Oct14 0:00 [bash] root 3740 0.0 0.0 0 0 ? Zs Jun17 0:00 [bash] root 4200 0.0 0.0 0 0 ? Zs Oct22 0:00 [bash] root 5591 0.0 0.0 0 0 ? Zs Sep10 0:00 [bash] root 6917 0.0 0.0 0 0 ? Zs Jun02 0:00 [bash] root 8702 0.0 0.0 0 0 ? Zs Oct09 0:00 [bash] root 9315 0.0 0.0 0 0 ? Zs Jul29 0:00 [bash] root 9327 0.0 0.0 0 0 ? Zs Jul22 0:00 [bash] #...
2.3 列出睡眠进程
ps aux | grep " D "
可见如下输出,
root 305 0.0 0.0 116888 168 ? D Oct01 0:00 /usr/sbin/lsof -p 79614 root 311 0.0 0.0 116888 176 ? D Oct05 0:00 /usr/sbin/lsof -p 79614 root 313 0.0 0.0 116888 164 ? D Oct19 0:00 /usr/sbin/lsof -p 26523 root 316 0.0 0.0 116888 168 ? D Sep15 0:00 /usr/sbin/lsof -p 54530 root 319 0.0 0.0 116888 168 ? D Oct01 0:00 /usr/sbin/lsof -p 79614 root 337 0.0 0.0 116888 172 ? D Oct11 0:00 /usr/sbin/lsof -p 79614 root 338 0.0 0.0 116888 164 ? D Oct20 0:00 /usr/sbin/lsof -p 26523 root 348 0.0 0.0 116888 168 ? D Oct21 0:00 /usr/sbin/lsof -p 47867 root 363 0.0 0.0 116888 168 ? D Oct12 0:00 /usr/sbin/lsof -p 79614 root 368 0.0 0.0 116888 172 ? D Sep07 0:00 /usr/sbin/lsof -p 54530 #...
没有评论