Ah! didn't believe Nodejs.org not running on Node.js itself

369 views
Skip to first unread message

Manish Bansal

unread,
Aug 25, 2014, 9:32:12 AM8/25/14
to nod...@googlegroups.com
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. 

Please share your thoughts.

Manish Bansal 

Message has been deleted

George Snelling

unread,
Aug 26, 2014, 12:36:37 AM8/26/14
to nod...@googlegroups.com
Nodejs.org is a static site.  Nginx usually serves static sites faster than most dynamic servers, including node.js.  Right tool for the job.

Most folks who run node.js in production either use some sort of external process monitor or the cluster module to cycle crashed processes.   Some folks consider this approach simpler than managing threads.  Others don't.   A lot depends on the skills you have in house.

-g

Issac Roth

unread,
Aug 26, 2014, 12:57:31 AM8/26/14
to quali...@gmail.com, nod...@googlegroups.com
Hi Manish,

Most people run their Node.js apps in a “cluster” which enables multiple threads and under “supervision” which restarts failed threads. For example, this is automated using the open source slc run helper. There are other process managers which achieve similar effect.

# slc run —cluster cpus app.js

That will use all CPUs on the machine and load balance requests between worker processes, restarting processes when there is a failure.

You may also be interested in the error handling work in the Zones project which allows you to more easily code defensively to avoid unhanded exceptions from crashing the server. There are other similar approaches such as trycatch.

Nginx is commonly combined with Node apps as an accelerator but is not required and plenty of people use Apache or IIS or others.

Issac
--
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 nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a9daf644-6430-4d3f-a3c1-0af1f5ef7049%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ahmed Eldosoukey

unread,
Aug 26, 2014, 1:25:28 AM8/26/14
to nod...@googlegroups.com
Hello Manish,

  Using the combination of Cluster & Domain modules you can run safely. If you'd like, you might isolate each user request in a domain, and have a general on('error') handler that will handle any unhandled exception for you.

Regards,
Ahmed

Alex Hokanson

unread,
Aug 26, 2014, 7:13:32 AM8/26/14
to nod...@googlegroups.com
Another thing to keep in mind is that some sites use Nginx as a proxy for dynamic content. So the dynamic content gets forwarded to the node.js web server while static content is served directly from Nginx. This allows the node.js runtime the ability to use its power for more important things

Alex Kocharin

unread,
Aug 27, 2014, 4:28:32 AM8/27/14
to nod...@googlegroups.com
 
node.js is running in a single thread. But you don't have to have just one node.js process, right?
 
Just run a bunch of them with a `cluster` module. Basically, that's what PM2 does (it's the most popular wrapper for clusters as of now). 
 
Or run them all on separate ports and use nginx for routing. Oh... that's kind of funny, I just suggested a "3rd party webserver" you complained about. :)
 
Anyway, node.js is the best at what it does (that's scripting and writing servers), and nginx is the best at what it does (that's static file serving and basic routing). There is almost no overlapping between the two, and there is no reason not to use both if you have to.
 
 
25.08.2014, 21:53, "Manish Bansal" <quali...@gmail.com>:
--

TigerNassau

unread,
Aug 27, 2014, 4:34:07 PM8/27/14
to nod...@googlegroups.com
Nodejs.org should run node-http-proxy instead of nginx - if the team really does not think its as strong, then it should be improved - eat your own dogfood!

Sent from my LG Mobile

Alex Kocharin <al...@kocharin.ru> wrote:

Joshua Holbrook

unread,
Aug 27, 2014, 4:46:26 PM8/27/14
to nod...@googlegroups.com
Node core did not write, and does not endorse, node-http-proxy. It was
entirely written by a third party.

For most people, there is absolutely no reason to not just use nginx
for balancing/proxying and serving static content in concert with
node. In fact, for me it's worked really well.

--Josh
> --
> 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 nodejs+un...@googlegroups.com.
> To post to this group, send email to nod...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/iy8ruhdx5c0it0h8udg8xb00.1409152026462%40email.android.com.

Brett Ritter

unread,
Aug 27, 2014, 4:47:17 PM8/27/14
to nod...@googlegroups.com
On Wed, Aug 27, 2014 at 8:07 AM, TigerNassau <john.tig...@gmail.com> wrote:
> Nodejs.org should run node-http-proxy instead of nginx - if the team really does not think its as strong, then it should be improved - eat your own dogfood!

You don't apply dogfood to a burn to heal it - nodejs.org should use the right tool for the job.  

I'm all in favor of eating your own dogfood - if you're hungry.

Otherwise I'd rather have them working on features I care about.

--
Brett Ritter / SwiftOne
swif...@swiftone.org

TigerNassau

unread,
Aug 27, 2014, 10:14:18 PM8/27/14
to nod...@googlegroups.com
Sounds like NIH syndrome. Node-Http-Proxy works great for us as does Express and yes it would make sense that the Node team promote and use as much as possible node based solutions. Not to do that smells bad

Sent from my LG Mobile

Joshua Holbrook <josh.h...@gmail.com> wrote:

>Node core did not write, and does not endorse, node-http-proxy. It was
>entirely written by a third party.
>
>For most people, there is absolutely no reason to not just use nginx
>for balancing/proxying and serving static content in concert with
>node. In fact, for me it's worked really well.
>
>--Josh
>

>On Wed, Aug 27, 2014 at 11:07 AM, TigerNassau


><john.tig...@gmail.com> wrote:
>> Nodejs.org should run node-http-proxy instead of nginx - if the team really does not think its as strong, then it should be improved - eat your own dogfood!
>>

>> Sent from my LG Mobile
>>
>> Alex Kocharin <al...@kocharin.ru> wrote:
>>
>> --
>> 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 nodejs+un...@googlegroups.com.
>> To post to this group, send email to nod...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/iy8ruhdx5c0it0h8udg8xb00.1409152026462%40email.android.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>--
>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 nodejs+un...@googlegroups.com.
>To post to this group, send email to nod...@googlegroups.com.

>To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAHL2YmpW%3Dy8SZBqbW4M%3Dhd7Yx-0_%2B0zUrcwXvYARVFhtLJVZiA%40mail.gmail.com.

Michael Hart

unread,
Aug 27, 2014, 11:30:54 PM8/27/14
to nod...@googlegroups.com
I can't tell if you're trolling or not... but nodejs.org using nginx is *literally the opposite* of NIH syndrome.

Hongli Lai

unread,
Aug 28, 2014, 3:23:46 AM8/28/14
to nod...@googlegroups.com
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.

// ravi

unread,
Aug 28, 2014, 5:12:16 PM8/28/14
to nod...@googlegroups.com
On Aug 27, 2014, at 11:30 PM, Michael Hart <michael...@gmail.com> wrote:

I can't tell if you're trolling or not... but nodejs.org using nginx is *literally the opposite* of NIH syndrome.


Could you tell if the OP was trolling or not? :-)

   -- Ravi



TigerNassau

unread,
Aug 28, 2014, 5:12:23 PM8/28/14
to nod...@googlegroups.com
Sigh, you don't get it so I wii stop with this. Node.js is a server. So it makes sense to have proxy and balancing libs all be a part of it. Its also open source relying on a community. Using other node pkgs to serve its own website helps build the node community and strengthens each library. ignoring a "3rd party" node lib in favor of another totally different server project seems pretty counter productve or lack of confidence or even infighting between node projects (what was meant by NIH). Nothing against nginx - its a great project - but its not node - its a very different server alternative. We like and depend on node, express, and node-http-proxy so want to see them all grow and be strengthened.
Sent from my LG Mobile

Michael Hart <michael...@gmail.com> wrote:

>I can't tell if you're trolling or not... but nodejs.org using nginx is
>*literally the opposite* of NIH syndrome.
>

>On Wednesday, 27 August 2014 22:14:18 UTC-4, John wrote:
>>
>> Sounds like NIH syndrome. Node-Http-Proxy works great for us as does
>> Express and yes it would make sense that the Node team promote and use as
>> much as possible node based solutions. Not to do that smells bad
>> Sent from my LG Mobile
>>

>> Joshua Holbrook <josh.h...@gmail.com <javascript:>> wrote:
>>
>> >Node core did not write, and does not endorse, node-http-proxy. It was
>> >entirely written by a third party.
>> >
>> >For most people, there is absolutely no reason to not just use nginx
>> >for balancing/proxying and serving static content in concert with
>> >node. In fact, for me it's worked really well.
>> >
>> >--Josh
>> >
>> >On Wed, Aug 27, 2014 at 11:07 AM, TigerNassau
>> ><john.tig...@gmail.com <javascript:>> wrote:
>> >> Nodejs.org should run node-http-proxy instead of nginx - if the team
>> really does not think its as strong, then it should be improved - eat your
>> own dogfood!
>> >>
>> >> Sent from my LG Mobile
>> >>
>> >> Alex Kocharin <al...@kocharin.ru <javascript:>> wrote:
>> >>
>> >> --
>> >> 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 nodejs+un...@googlegroups.com <javascript:>.


>> >> To post to this group, send email to nod...@googlegroups.com

>> <javascript:>.


>> >> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/nodejs/iy8ruhdx5c0it0h8udg8xb00.1409152026462%40email.android.com
>> .
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >--
>> >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 nodejs+un...@googlegroups.com <javascript:>.


>> >To post to this group, send email to nod...@googlegroups.com

>> <javascript:>.


>> >To view this discussion on the web visit

>> https://groups.google.com/d/msgid/nodejs/CAHL2YmpW%3Dy8SZBqbW4M%3Dhd7Yx-0_%2B0zUrcwXvYARVFhtLJVZiA%40mail.gmail.com

Mark Hahn

unread,
Aug 28, 2014, 6:35:28 PM8/28/14
to nod...@googlegroups.com

Nginx is much faster than  node-http-proxy.
Reply all
Reply to author
Forward
0 new messages