node js server related

 forever is a node.js package that is used to keep the server alive even when the server crash/stops.

 When the node server is stopped because of some error, exception, etc. forever automatically restarts it


A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)


Forever can be used as


forever start app.js

The purpose of Forever is to keep a child process

 (such as your node.js web server) running continuously and automatically restart it when it exits unexpectedly.


Node.js Cluster Process Module:

The cluster module provides a way of creating child processes that runs simultaneously and share the same server port.


Node.js runs single threaded programming, which is very memory efficient, but to take advantage of computers multi-core systems, 

the Cluster module allows you to easily create child processes that each runs on their own single thread, to handle the load.


https://www.geeksforgeeks.org/how-does-the-cluster-module-work/



My take is do not use an in-container process supervisor (forever, pm2) and instead use docker

 restart policy via the --restart=always (or one of the other flavors of that option). 

This is more inline with the overall docker philosophy,

 and should operate very similarly to in-container process supervision since docker containers start running very quickly.


https://www.npmjs.com/package/node-windows

https://www.youtube.com/watch?v=obXr1NtSEOU

Comments

Popular posts from this blog

interview questions js[ Anurag Singh ProCodrr]

reactnative_creation