Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

rebooting node.js cluster workers

rebooting node.js cluster workers

Problem

I have a node app I use cluster to run on multiple cores.

I'm running into an issue where when my app throws an exception, the Worker dies and doesn't restart. That makes sense, but I'm wondering if there is a better way to handle restarting these workers instead of having to monitor it or try/catch or listen for every error.

I've used forever before, and it seems like something like this would work well for cluster.

Is there a way to reboot them, or add "pokemon" exception handling at a top layer in express to make sure my workers won't die if there's an unexpected exception?

Problem courtesy of: Jesse

Solution

There are many 3rd party tools that can help with this. Monit (http://mmonit.com/monit/) is quite popular in the Node community. Another option, of many, is supervise (http://cr.yp.to/daemontools.html).

Solution courtesy of: Ryan Olds

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

rebooting node.js cluster workers

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×