O'Reilly logo

Pro Express.js by Azat Mardan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 13

image

Multithreading with Clusters

There are a lot of detractors out there arguing against the use of Node.js, many of whose arguments are rooted in the myth that Node.js-based systems have to be single-threaded. Nothing could be further from the truth—and with the cluster module, we can effortlessly fork a Node.js process to create multiple processes. Yes, each process will still be single-threaded and be blocked by inapt synchronous code or some laborious processes (such as hashing of passwords). However, the whole system, now consisting of a few processes, won’t be blocked.

In the case of web apps, the processes can listen on the same ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required