node

18
How to node!

Upload: arjun-raj

Post on 18-Dec-2014

6.794 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Node

How to node!

Page 2: Node

•Javascript on the server

•Asynchronous and non-blocking code

•Event driven

•Scalable real-time applications

What is Node?

Page 3: Node

•NGINX

•Tornado

•Thin

Existing solutions

Page 4: Node

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

Page 5: Node

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

Page 6: Node

Node v/s the rest

Same environement. Variables : Fixed concurrency of 300, size of response

Page 7: Node

•Runs on Google’s V8 Engine

Javascript on the Server?

Page 8: Node

•Request is processed sequentially

•Queued requests

Conventional Server

Page 9: Node

•Concurrent execution

•Non-blocking code

•Scalable

Asynchronous Server

Page 10: Node

How does Node do it all?

Page 11: Node

Node Server//Node

http = require('http');

http.createServer(function(request, response){

   response.writeHead(200);

  response.write('Hello World');

 response.end();

}).listen(8000);

Page 12: Node

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);

Page 13: Node

Examples

Page 14: Node

Real World Real Time App

•Hummingbird

•Wheat

•Multi player games

•Real time push notifications

Page 15: Node

Extend Node

•NPM

•Socket.io

•Now

•Express.js

Page 16: Node

•Why to Node?

•When to Node?

•When not to?

How to Node?

Page 17: Node

•http://nodejs.org

•http://npmjs.org

•http://howtonode.org

•http://github.com/joyent/node

Resources

Page 18: Node

Thanks

Arjun Raj

(http://athousandnodes.com | @athousandnodes)