I am using Ubuntu 14.04 server (8 cores, 16 GB RAM) for hosting a PHP website, MySQL and Redis. PHP web and MySQL has very low traffic (MySQL: Queries per second avg: 0.825). Redis processes 8011 commands per second.
Today I have noticed that nc stays in the top of 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 gives:
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
A quick lookup on man poll
gives me info that poll waits for one of a set of file descriptors to become ready to perform I/O.
How do I find out what is happening to file descriptors (is it file descriptors issue?) and fix nc eating up 100% CPU?