think I could clarify a few things here. Some of the observations/assertions 
made are incorrect. Anyways, my 2 cents (corrections & response).

1. nginx executes code.

2. In nginx you write async code all the time for the network and I/O. You are 
writing them in C whereas in nodejs u write in js. Its generally difficult to 
write async code in C. Whereas in js, functions are first-class so aync code 
appears more elegant and needs lesser boilerplate. Btw, you can only write code 
for modules or when implementing new network I/O protocols in nginx. Most of 
the times you are just using the conf file and occasionally you may have used 
some if-else construct which doesn't mean that u write sync code nginx. 

3. There could be some overlap in the objectives of nginx and nodejs but they 
need not be compared. The good news is you can use nginx to serve static 
content of nodejs web project. The stacks u mentioned are ok too. 

// Krishna

Sent from my BlackBerry

-----Original Message-----
From: MHK <[email protected]>
Sender: [email protected]
Date: Wed, 15 Aug 2012 03:24:57 
To: <[email protected]>
Reply-To: [email protected]
Subject: [nodejs] Being both event-driven servers, why node.js needs async
 code where Nginx doesn't?

 

Being both event-driven servers, why node.js needs async code where Nginx 
doesn't? In another words, if Nginx works as the same event-driven async IO 
model of node, why doesn't it requires writing async style code? I know, 
Nginx is *NOT* actually executing any code, rather proxying them to who 
can. Then why doesn't node do so? Are we missing anything in the current 
Ngninx way? Or, gaining anything more from node (apart from the pain of 
writing async codes)?

To be more specific, how different is Nginx+php-fpm or 
Nginx+wsgi+python/ruby from node alone regarding performance or utilizing 
computing resource that node claims? Couldn't node just use existing 
FastCGI models, be a sync style JavaScript interpreter and let webserver do 
its async job?

PS. This question is cross-posted in 
stackoverflow<http://stackoverflow.com/questions/11966292/being-both-event-driven-servers-why-node-js-needs-async-code-where-nginx-doesn>
.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to