Ticket #4205 (closed Bugs: fixed)
Excessive CPU using in run_one in ASIO
|Reported by:||Tim Smith <tim@…>||Owned by:||chris_kohlhoff|
OS: Windows Server 2003
In the windows code for run_one, we are seeing excessive CPU when using timers. We didn't see this issue with 1.40.
The problem turns out to be that when we have timers, the computation for timeout (via get_timeout()), is too small. Thus the IOCP query returns and no timers are delivered. This leads to a flurry of CPU usage where the timeout is zero and no timers are still delivered. The CPU usage stops when the next pending timer is finally delivered.
To resolve the issue (a total temporary hack to our code), we added a bias of 1ms to the call to get_timeout(). (i.e. timeout = get_timeout() + 1;). This caused the CPU usage to drop back down to normal levels.