2

I am using Webrtc, nodejs, Expressjs as the framework to create a audio, video and chat application. I have used Forever so that the script runs continuously.

As my application deals with audio, video and chat. User presence plays an important role. We need to have the system up and running always and avoid system crashes and restart. If it happens we are going to loose all information regarding the users who were online. Need Suggestions what are the best approaches to avoid such situations.

Also, while moving new features to the production server, what steps should we take into consideration so that the application doesn't stop and henceforth we don't loose user information.

What if the server went down or we had to make it down. What are the different techniques that can be used so that we don't loose the presence information of the online users in the system and restore them back(if necessary).

Jeet
  • 717
  • 6
  • 18
  • You should be using stateless api calls with a common key-value store to simulate a state where one is requires. You should also be using a message queue between your Node processes, in addition to the common key-value store. Every server should be able to take care of any request, indifferent of the routing consecutive requests take. When deploying multiple processes with persistent connection, don't take them down until all the connections have been disconnected and make sure no new connections are made. The list goes on... how far is the application from the deployment? :) – randunel Aug 05 '13 at 14:41

1 Answers1

0

1) use node cluster to fork multiple process per core. So if one process died, another process will be auto boot up. Check out: http://nodejs.org/api/cluster.html

2) use domain to catch asyn operation instead of using try-catch or uncaught http://nodejs.org/api/domain.html. I'm not saying that try-catch or uncaught is bad thought!

3) use forever/supervisor to monitor your services

4) add daemon to run your node app: http://upstart.ubuntu.com

hope this helps!

I also answered at this post: How do I prevent node.js from crashing? try-catch doesn't work

Community
  • 1
  • 1
Nam Nguyen
  • 5,668
  • 14
  • 56
  • 70