3

I'm starting to use node.js and am looking for the best way to host multiple node.js demos (>20) on one server. My only requirement is that an error in one not take down the rest.

So far I've looked at:

  • Multiple node.js instances - this works but the overhead is quite high with a large number of demos processes
  • Express front end routing to individual demo files - no overhead but one error brings everything down
  • Using the cluster module to run each module as a sub-process - I'm currently researching this option, seems promising but requires some work (and cluster is still only experimental)

Can anyone suggest a better way? How have other people done it?

Phil
  • 1,110
  • 1
  • 9
  • 25
  • 1
    [This post](http://stackoverflow.com/q/5999373/575527) regarding crash prevention might help – Joseph Nov 20 '12 at 13:28

1 Answers1

1

I am taking the something like approach #1 and #3 combined. I have apache (yeah, I know, lame, but I do share this server with others who need/want it), and I use mod_proxy as a route to the webapps. Each app then has its own node.js daemon.

That way I can run each app on its own port and route there from apache. Probably not good for your use case, as I only have 2-3 weabpps on at the time.

Zlatko
  • 18,936
  • 14
  • 70
  • 123