From the course: Advanced Node.js: Scaling Applications

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Forking processes

Forking processes

- [Instructor] Because Node.js is single threaded, we've run into the need to scale our applications much sooner that we would if we were using another programming language. It's not a problem. This is actually a benefit of Node because we get to talk about scaling much earlier in the application lifecycle because Node applications are made to scale. Node.js is designed to clone your application and then run it using multiple instances simultaneously. This process is called forking. Let's take a look at how we can fork our advice server. So I'm looking at our exercise files within chapter one lesson three, and I'm looking at the app.js file found in the start folder. In this file, you can see that we already have some code for you. So here we have an HTTP server that's serving advice. On line four, those are the advice options. So this server's gonna randomly give you one of these options. On line 12, that's where we…

Contents