Node Js - Scale Node Application (Why? (allows us to fork work from the…
Node Js - Scale Node Application
allows us to fork work from the main application to
that can be processed in parallel with each other and the main application
Most servers have
cluster built-in modules
available in Node.js
to facilitate the creation of
on multi-core CPU based system
spawn(command, [args], [options])
: Launches a new child process and returns a child process object.
: Launches a new child process and runs the given command in a shell.
: Specialized form of spawn() method for creating child processes.
built on top of
method which is used to do the
between the child processes running in parallel
Spawn a new child process and all the child processes share the same server ports.
: Emitted when a new worker is forked.
: Emitted when the worker is running.
: Emitted when worker becomes online and start listening to the requests.
: Emitted when a worker is killed.