On 2/11/2016 21:57, Niall Douglas wrote:
It's true a lot of people will be surprised AFIO v2 has a totally different async i/o engine design to ASIO. The easy answer is that POSIX AIO gives you no choice, but the fuller answer is that I had a small contract last year to give some expert consulting advice on a very, very high end storage system which was experiencing unhelpful random latency spikes. I benchmarked IOCP vs alertable vs synchronous, and the performance increased in exactly that order i.e. synchronous is easily the fastest, alertable not bad if you don't overload a given thread, IOCP awful.
Interesting. I had a serial-port-based application which used a thread-per-port model with synchronous I/O (technically still overlapped, but it used WaitCommEvent then read that many bytes, so reading was never really async). Latency spikes got quite bad as the number of ports rose. Switching it to an ASIO thread-agnostic reactor model helped a little but not much (mostly due to strand locking), but using "raw" IOCP worked wonders.