Why is Node.js scalable?

The javascript that node runs is single threaded, but a lot of the things you call in node – such as network or file io – run in background threads. See this post for a basic overview: Node is not single threaded

If you need the gritty details, you should look into libuv which is the ‘magic’ piece converting threads into event loops: http://nikhilm.github.io/uvbook/basics.html#event-loops

Additionally, if you need to do something CPU intensive in node itself, you can easily send this to a child process – see http://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options for details

Leave a Comment