Open fedjabosnic opened 7 years ago
Although this doesn't completely resolve this issue, we have added TCP Afterburn
in feature #57.
Afterburn
keeps the tcp transport actively polling the socket for a short time after a message is received, in the expectation that the next message will arrive shortly after. If no messages are received within the afterburn period, the tcp transport will fall into a non cpu-bound wait state, awaiting more data on the socket.
The table below shows the trade-offs between afterburn
and normal
modes:
Mode | Latency | CPU utilization |
---|---|---|
Afterburn | Low | High |
Normal | High | Low |
The
afterburn period
is currently not configurable (hard-coded to one second), but we will expose this in an upcoming release...
At present, we have a very simple socket read loop which spins over
Socket.DataAvailable
. While this is good in terms of reading messages as soon as they arrive, it isn't so good for cpu usage, especially on lower throughput connections where we just chew up cpu needlessly.Some ideas: