Posts

Showing posts with the label event

Node.js Event Model

Node.js has gained lot of traction in the last few years and many high performance sites are today using it. When we started with it, I wanted to understand what’s it that makes node.js so high performant, over and above the regular web servers, which were created with the purpose of being able to handle loads of incoming requests. The answer lies in the core of node.js that uses a single thread for its main execution and passes on the work to asynchronous functions. In the world of multitasking and multi-core CPU machines, this come as a surprise, but then when you look at the cost of creating all these parallel threads vs handling all incoming requests in a single thread, you suddenly realize the benefits, and is very clearly visible also in the performance it delivers. As I thought about this, I realized that this concept isn’t new but is something that is at the heart of windows programming, something I had learnt back in 1995. We had started programming on Windows for Wo...