Upload
arjun-raj
View
6.785
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
How to node!
•Javascript on the server
•Asynchronous and non-blocking code
•Event driven
•Scalable real-time applications
What is Node?
•NGINX
•Tornado
•Thin
Existing solutions
Node v/s PHP
PHPPHP NodeNode
"Hello World" Simple html file
3177.27 5579.30
"File Read" Textfile of 100KB
20.31 47.21
"Read Remote File"Read a remote page and deliver
3.21 6.43
Node v/s the rest
Tested under Ubuntu using a Intel Core 2 Duo,2.53 GHz, 4 GB memory, Approximately 100 byte response for each
Node v/s the rest
Same environement. Variables : Fixed concurrency of 300, size of response
•Runs on Google’s V8 Engine
Javascript on the Server?
•Request is processed sequentially
•Queued requests
Conventional Server
•Concurrent execution
•Non-blocking code
•Scalable
Asynchronous Server
How does Node do it all?
Node Server//Node
http = require('http');
http.createServer(function(request, response){
response.writeHead(200);
response.write('Hello World');
response.end();
}).listen(8000);
Event Driven//JSwindow.onload = function(){ document.body.innerHTML = 'Hello World';};
//Node
http = require('http');
http.createServer(function(request, response){
response.writeHead(200);
response.write('Hello World');
response.end();
}).listen(8000);
Examples
Real World Real Time App
•Hummingbird
•Wheat
•Multi player games
•Real time push notifications
Extend Node
•NPM
•Socket.io
•Now
•Express.js
•Why to Node?
•When to Node?
•When not to?
How to Node?
•http://nodejs.org
•http://npmjs.org
•http://howtonode.org
•http://github.com/joyent/node
Resources
Thanks
Arjun Raj
(http://athousandnodes.com | @athousandnodes)