Using the Node.js cluster module – Advanced Express Video Tutorial | LinkedIn Learning, formerly Lynda.com
“
– [Instructor] Node.js runs in a single process, and basically in one thread. This means that it does not fully utilize all CPUs on a host. To remedy this, Node.js provides a cluster module, that will spin up chart processes. Under the hood, Node.js then uses interprocess communication to distribute the load between the chart processes, round robin. Node cluster is not the only way to achieve this. For example, if you use the process manager PM2, as we will do later, it can be configured to scale up to all CPUs as well. Still, to understand the basic principle behind clustering, we will now implement this from scratch using Node cluster. Before we optimize this, let’s run a little load test against our current application. So, on the console, I’m using a patch bench, and we want to concur and see if 10, and I’m running one hundred request against the website. This takes a little bit, and we see that we have a time per request of around 39 milliseconds. Now, let’s see what we can gain…