[英]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.