On Monday, August 25, 2014 3:32:12 PM UTC+2, Manish Bansal wrote: > > Hi Friends, > I am very new to node.js and still exploring few opportunities where i can > use this server/technology for our development in a pilot project > effectively and efficiently. so far my experience is great, BUT the biggest > issue i found with node is (which is often advertised as pros) the > development technology + server is running in single thread. therefore any > unhandled unexpected exception which is causing due to > programming/environmental issues brings the server down. when i am thinking > about all other innocent users connected to my single threaded node > servers, my decisions gets influenced. > overthemore when i came to know Nodejs.org is also hosted on 3rd party > webserver "nginx" i took my step back of trying this attempts. >
Another alternative is to use Phusion Passenger, an open source application manager which solves exactly this problem: https://www.phusionpassenger.com/node_weekly It runs your application in multiple processes and load balances and supervises them. If one of your processes crash, Phusion Passenger will automatically restart it. In this aspect, it's similar to cluster+pm2/forever and slc. But unlike cluster/pm2/forever/slc, you don't need to modify your app. Most apps work out-of-the-box on Passenger, like this: # Runs your app.js with 6 processes $ passenger start --app-type node --startup-file app.js --min-instances 6 Another cool feature is that Phusion Passenger can *integrate* into Nginx. Normally you have to run Nginx, and then run your app (and perhaps use pm2 to supervision), and then tie the two together with reverse proxy configuration. Phusion Passenger can act like a 'mod_nodejs' for Nginx: you just tell Nginx where your app is, and then Nginx will (with the help of Passenger) start and supervise it, so that you only have one tool to worry about instead of a whole bunch of moving parts. Here's an example Nginx configuration snippet that takes care of everything: server { server_name www.myapp.com; root /webapps/myapp/static_files; # Add this: tells Passenger where your app is passenger_app_root /webapps/myapp; passenger_app_type node; passenger_startup_file app.js; passenger_enabled on; } Phusion Passenger also makes administration, management and introspection much easier. For example, what if you want to know what your app is doing? Is it misbehaving? Why is it stuck? What requests is it handling right now? Passenger provides tools so that you can get answers to these questions quickly. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/e349fd0d-9165-405d-a58f-12e617df8658%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
