[英]Ubuntu 14.04 nc 100% CPU usage
我使用Ubuntu 14.04服务器(8核,16 GB RAM)来托管PHP网站,MySQL和Redis。 PHP Web和MySQL的流量非常低(MySQL:每秒查询数:0.825)。 Redis每秒处理8011个命令。
今天我注意到nc仍top
:
8348 root 20 0 11224 764 624 R 100.0 0.0 2277:01 nc
8319 root 20 0 11224 760 624 R 100.0 0.0 2277:59 nc
8324 root 20 0 11224 764 624 R 100.0 0.0 2278:09 nc
8344 root 20 0 11224 760 624 R 100.0 0.0 2277:07 nc
Stracing nc给出:
root@host:/home/user# strace -p 8348
Process 8348 attached
poll([{fd=3, events=POLLIN}, {fd=-1}], 2, 1000) = 1 ([{fd=3, revents=POLLERR}])
poll([{fd=3, events=POLLIN}, {fd=-1}], 2, 1000) = 1 ([{fd=3, revents=POLLERR}])
poll([{fd=3, events=POLLIN}, {fd=-1}], 2, 1000) = 1 ([{fd=3, revents=POLLERR}])
intentionally cutted N lines from output
快速查找man poll
poll waits for one of a set of file descriptors to become ready to perform I/O.
有关poll waits for one of a set of file descriptors to become ready to perform I/O.
我如何找出文件描述符发生了什么(文件描述符问题?)并修复nc占用100%CPU?
我们最近遇到了类似的问题。 我们有一个cron作业通过netcat
将一些redis统计信息发送到udp上的石墨,并且在上周将我们的一个石墨主机关闭了一段时间之后,我们注意到我们的redis盒子上的CPU使用率暴涨。 它似乎是netcat
一个错误: https : netcat
? netcat
= netcat
我们运行的命令是这样的:
echo "{redis_metric}" | nc -w 1 -u ${graphite_host} 8125
使用'quit'选项(-q)而不是'timeout'选项(-w),似乎可以解决我们的问题:
echo "{redis_metric}" | nc -q 1 -u ${graphite_host} 8125
希望有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.