Asynchronous I/O in NodeJS - new standard or challenges?
1. Asynchronous I/O in NodeJS - Standard and challenge of web programming? Pham Cong Dinh @ SkunkWorks @pcdinh BarCamp Saigon 2011 Follow us on Twitter: @teamskunkworks
11. Threads: A process contains multiple threads. A single thread is assigned to handle an incoming request. Thread-per-request model
12. Events: A process consists of the processing of a series of events. At any instant in time, a single event/request is being processed. The process is not blocked on I/O request.
13. Request handling: Process / Threads / Events Threads shares ● D efault share memor y ● F ile descriptors ● Filesystem context ● Signals and S ignal handling
14. Request handling: Process / Threads / Events Thread creation is expensive - From iobound.com
15. Request handling: Process / Threads / Events Context switching is expensive
16. Request handling: Process / Threads / Events Blocking model: Process and Threads
18. Request handling: Event-driven IO loop issue poll vs. epoll epoll: O(1) or O(n=active)
19. Request handling: Event-driven callback issues Non-blocking IO Loop vs. Blocking callback Event dispatching is not blocked Callback can be blocked Mixing asynchronous code and synchronous code can be bad