Chinaunix

标题: 请问进程有关D状态。 [打印本页]

作者: hegu    时间: 2014-07-25 16:45
标题: 请问进程有关D状态。

我服务器的nginx进程很多是D状态:但是系统的cpu不高,才10%左右。
现在很多d状态导致用户连接进程超时。
请问有什么办法能查nginx是阻塞在什么地方?谢谢了。
用strace查,发现主要的操作都在sendfile:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
81.29    0.003614          48        76           sendfile
11.13    0.000495          10        50           readv
  4.05    0.000180           2        89           writev
  3.53    0.000157           5        30           close
  0.00    0.000000           0        11           write
  0.00    0.000000           0         5           open
  0.00    0.000000           0         6         2 stat
  0.00    0.000000           0         5           fstat
  0.00    0.000000           0         3           ioctl
  0.00    0.000000           0        10           socket
  0.00    0.000000           0         3           accept
  0.00    0.000000           0        12           sendto
  0.00    0.000000           0        24        12 recvfrom
  0.00    0.000000           0         2           shutdown
  0.00    0.000000           0         7           getsockname
  0.00    0.000000           0        14           setsockopt
  0.00    0.000000           0         2           getsockopt
  0.00    0.000000           0         2           epoll_wait
  0.00    0.000000           0         4           epoll_ctl
------ ----------- ----------- --------- --------- ----------------
100.00    0.004446                   355        14 total

nginx状态:
root     10839  5.7  1.1 153144 91428 ?        S    15:10   3:34 nginx: work
er process
root     10840  6.0  1.0 140676 82612 ?        S    15:10   3:44 nginx: work
er process
root     10841  5.7  1.0 144412 86080 ?        D    15:10   3:34 nginx: work
er process
root     10842  5.8  0.9 135428 77112 ?        S    15:10   3:37 nginx: work
er process
root     10843  5.9  1.0 145780 83380 ?        D    15:10   3:43 nginx: work
er process
root     11818  1.2  1.9 332380 159448 ?       D    15:14   0:43 nginx: work
er process
root     11819  1.2  2.0 339788 166888 ?       D    15:14   0:44 nginx: work
er process
root     11820  1.2  1.9 331148 156104 ?       D    15:14   0:42 nginx: work
er process
root     11821  1.3  1.9 331448 156388 ?       D    15:14   0:46 nginx: work
er process
root     11822  1.4  1.9 335668 162712 ?       D    15:14   0:50 nginx: work
er process
root     11823  1.3  1.9 336032 163148 ?       D    15:14   0:48 nginx: work
er process
root     11824  1.3  1.9 329228 156328 ?       D    15:14   0:47 nginx: work
er process
root     11825  1.3  1.9 332944 160024 ?       D    15:14   0:45 nginx: work
er process
作者: hegu    时间: 2014-07-25 19:45
有人知道吗?

自己顶一下,谢谢了。
作者: action08    时间: 2014-07-27 19:20
sendfile在做什么啊,bug的可能大些,估计应该不是被黑了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2