Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js upstart vs forever

I am looking to daemonize my Node.js application. What's the difference between upstart and forever? Also, are there other packages I might want to considering looking at?

like image 874
user1802143 Avatar asked Dec 15 '13 23:12

user1802143


People also ask

Why do you use forever with node js?

Forever is an npm module that ensures a Node. js script continuously runs in the background on the server. It's a helpful CLI tool for the production environment because it helps manage the Node applications and their processes.

Is node js the best platform for CPU heavy applications Why?

Avoid Using Node.js: Processing CPU heavy and complex applications: Node. js uses an event-based, non-blocking I/O architecture and only has one CPU – all of that intensive CPU processing would block incoming requests. As a result of the high-end number crunching, the thread might get stuck.

Is node js still relevant 2020?

js, introduced back in 2009, is not one of these. Node. js development has become very popular over the last four years and continues to stand the competition in 2022 making startups worldwide choose it over other available options.

Is Nodejs popular 2021?

Node. js has the best tools for the development of various applications and it's highly popular among software developers. Nevertheless, like any other development platform Node.


1 Answers

As pointed out in the comments, upstart will be used to start the forever script, since upstart has hooks for system events (like shutdown and startup of your server).

The other differences are:

  • Upstart was developed for Linux, while forever is platform-independent.
  • Forever is specific to nodejs, and has some pretty cool features with regards to restarting your server after it crashes, and logging.
  • Forever is sufficient for development environment, while upstart is necessary if you need to have some control over how your server is stopped. For example, on shutdown, the forever process would simply get killed, but, with an upstart script, you can collect logs and notify the admin.
  • Upstart allows you to add other monitoring tools, like Monit.

Among the available other solutions, you can try daemon, which is equivalent to forever.

I would disagree with @leorex with regards to upstart setup. Check out this blog post for an excellent example.

like image 163
verybadalloc Avatar answered Oct 12 '22 00:10

verybadalloc