Comparison
Event loopvsNon-blocking I/O
Event loop
one thread sits in a loop pulling ready events off a queue and running the callback for each one.
The execution model behind Node.js, nginx and most async runtimes: a single thread dispatching completed I/O events to handlers. It removes locking within the loop, since only one handler runs at a time. It makes any long synchronous computation a full-service outage for the duration, which is why CPU work gets pushed to a worker pool.
Full entry →Non-blocking I/O
the thread issues the request and goes off to do other work instead of sitting there waiting for the socket.
I/O that returns immediately and notifies you on completion, so one thread can have thousands of operations in flight. It is what lets a small number of threads serve very high concurrency for I/O-bound workloads. It buys nothing for CPU-bound work, and one accidental blocking call inside an event loop stalls every request on that loop.
Full entry →