Node.js works in single-threaded, non-blocking performance, working as a single process in CPU. No matter how powerful server is used and the resources utilized, what a single-threaded process can do is limited. Node.js is designed for building distributed applications with multiple nodes, hence the name Node.js.
Workload is one of the main reasons we start scaling our application, including availability and fault tolerance among others. Scaling can be done in multiple ways, one of the easiest available solution is Cloning. We can perform cloning using Cluster Module provided by Node.js.
Before we start handling requests with our resource-utilized Node.Js …
Tell me the difference…
Requiring a Module in NodeJs seems like a simple concept, you require a module using require(“module_name”) function and start working with it.
Modularity is the concept NodeJs is based on. Each module in Node has its own scope. A module cannot directly access things defined in another module unless it chooses to expose them. To expose things from a module, the module must be assigned to exports or module.exports. For a module to access another module’s exports or module.exports, it must use require().
When we require a module Node goes through following steps: