On Friday, 4 March 2016 at 06:55:29 UTC, Shachar Shemesh wrote:
On 03/03/16 19:31, Andrei Alexandrescu wrote:
https://www.mailinator.com/tymaPaulMultithreaded.pdf
On a completely different note, me and a colleague started a
proof of concept to disprove the claim that blocking+threads is
slower. We did manage to service several tens of thousands of
simultaneous connections using the one thread per client mode,
proving that the mere context switch is not the problem here.
Sadly, we never got around to bringing the code and the tests
up to the level where we can publish something, but, at least
in the case where a system call is needed in order to decide
when to switch fibers, I dispute the claim that non-blocking is
inherently faster.
It's not inherently faster. It just scales better in real-world
scenarios, assuming a limited number of worker threads. Blocking
IO is actually often fine in synthetic tests and in server to
server, but in real world situations where some clients have
modem-level bandwidth, a blocking write can ruin you.