What Really Makes Node.js Great

What Really Makes Node.js Great

Mmm… long story short, I wanted to learn how the heck node works. Read a lot of docs saying it’s asynchronous, it’s single-threaded, it’s all based on the event loop and whatnot. Basically, the words were scary I mean every guy says something huge using top-notch vocabulary and it just scared the shit out of me and my brain was like

that explains how an I/O call is handled.But what happens when there’s a CPU bound call? how does it handle it?

Read Don’t Block the Event Loop.

This is Node’s Achilles’ Heel: an errant thread can cause Node to block, thereby gumming up the works.

That’s why many developers are switching away from Node and using tools like Golang, which supports true concurrent programming in a relatively easy and convenient fashion.

Newer versions of nodejs are adding a simple “thread” support that can solve many of the issues with cpu intensive tasks. They are called Worker threads. In browsers there are Web Workers.