Ensuring uptime
We have seen that if a worker process crashes, a new one can be forked by the master process, while the remaining workers can handle the current requests. But what happens when the master process itself crashes?
Uptime concerns are a unique aspect of Node apps, but with proper knowledge and the right tools this concern can be addressed to satisfaction.
Let's look at two popular tools for ensuring Express apps are up and running, with as little downtime as possible.
Forever
Ensuring a Node app is restarted when it goes down can easily be accomplished with the help of a Node package called forever
.
Install forever
as global module, so that we can use it as a command-line tool:
$ npm install forever -g
After forever
is installed, type forever --help
at the command line to see the various options and commands.
Here is a list of the most common commands to help you get started:
Command |
Description |
---|---|
|
Starts
|