jcarreira / cirrus-kv

High-performance key-value store

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

100% CPU usage spin in TCPServer

TylerADavis opened this issue · comments

The TCPServer uses poll() to monitor multiple sockets at once, which should minimize CPU usage when the server is not actively sending or receiving data from the client. As expected, when the server is started it sees 0% CPU usage. However, after running a test, the usage jumps to 100% due to the server spinning on poll.

The log output is as below:

[INFO] - 1501532672807 Server calling poll.
[INFO] - 1501532672807 Poll returned with status:  1
[INFO] - 1501532672807 Non read event on socket:  3
[INFO] - 1501532672807 Non read event on socket:  4
[INFO] - 1501532672807 Server calling poll.
[INFO] - 1501532672807 Poll returned with status:  1
[INFO] - 1501532672807 Non read event on socket:  3
[INFO] - 1501532672807 Non read event on socket:  4
(etc.)