SlideShare a Scribd company logo
 A JavaScript runtime environment running
Google Chrome’s V8 engine
◦ a.k.a. a server-side solution for JS
◦ Compiles JS, making it really fast
 Runs over the command line
 Designed for high concurrency
◦ Without threads or new processes
 Never blocks, not even for I/O
 Uses the CommonJS framework
◦ Making it a little closer to a real OO language
 Instead of threads Node uses an event loop
with a stack
 Alleviates overhead of context switching
Threads Asynchronous Event-driven
Lock application / request with
listener-workers threads
only one thread, which
repeatedly fetches an event
Using incoming-request model Using queue and then processes
it
multithreaded server might
block the request which might
involve multiple events
manually saves state and then
goes on to process the next
event
Using context switching no contention and no context
switches
Using multithreading
environments where listener
and workers threads are used
frequently to take an incoming-
request lock
Using asynchronous I/O
facilities (callbacks, not
poll/select or O_NONBLOCK)
environments
 Request for “index.html” comes in
 Stack unwinds and ev_loop goes to sleep
 File loads from disk and is sent to the client
 Servers do nothing but I/O
◦ Scripts waiting on I/O requests degrades
performance
 To avoid blocking, Node makes use of the
event driven nature of JS by attaching
callbacks to I/O requests
 Scripts waiting on I/O waste no space
because they get popped off the stack when
their non-I/O related code finishes executing
NodeJS.ppt
 Use of JS on both the client and server-side
should remove need to “context switch”
◦ Client-side JS makes heavy use of the DOM, no
access to files/databases
◦ Server-side JS deals mostly in files/databases, no
DOM
 JSDom project for Node works for simple tasks, but not
much else
1. It's fast
2. It can handle tons of concurrent requests
3. It's written in JavaScript (which means you can
use the same code server side and client side)
Platform Number of request per
second
PHP ( via Apache) 3187,27
Static ( via Apache ) 2966,51
Node.js 5569,30
 http://nodejs.org/
 http://nodejs.org/cinco_de_node.pdf
 http://ajaxian.com/archives/google-chrome-
chromium-and-v8
 http://blog.chromium.org/2010/12/new-
crankshaft-for-v8.html
 http://news.softpedia.com/news/IE9-RC-vs-
Chrome-10-9-vs-Opera-11-vs-Firefox-11-
Performance-Comparison-183973.shtml

More Related Content

PPT
Node js
PPT
Node.js
PPT
PPTX
PDF
Node.js introduction
PPTX

Similar to NodeJS.ppt (20)

PPTX
Beginners Node.js
PPTX
Node.js
PDF
Real time web
PPTX
Node.js Test
PPT
18_Node.js.ppt
PDF
Introduction to Node JS.pdf
PPTX
Introduction to Node.js
PPTX
PPT
18_Node.js.ppt
PPTX
KEY
Introduction to node.js
PPTX
Nodejs intro
PPTX
NodeJS - Server Side JS
ODP
Introduce about Nodejs - duyetdev.com
PDF
Server Side Event Driven Programming
PPTX
An overview of node.js
PDF
PPTX
Scalable network applications, event-driven - Node JS
PPTX
Introduction to NodeJS
Beginners Node.js
Node.js
Real time web
Node.js Test
18_Node.js.ppt
Introduction to Node JS.pdf
Introduction to Node.js
18_Node.js.ppt
Introduction to node.js
Nodejs intro
NodeJS - Server Side JS
Introduce about Nodejs - duyetdev.com
Server Side Event Driven Programming
An overview of node.js
Scalable network applications, event-driven - Node JS
Introduction to NodeJS
Ad

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Business Ethics Teaching Materials for college
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
Insiders guide to clinical Medicine.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Institutional Correction lecture only . . .
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Renaissance Architecture: A Journey from Faith to Humanism
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Complications of Minimal Access Surgery at WLH
102 student loan defaulters named and shamed – Is someone you know on the list?
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Business Ethics Teaching Materials for college
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Pharma ospi slides which help in ospi learning
Insiders guide to clinical Medicine.pdf
01-Introduction-to-Information-Management.pdf
Anesthesia in Laparoscopic Surgery in India
O5-L3 Freight Transport Ops (International) V1.pdf
RMMM.pdf make it easy to upload and study
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Institutional Correction lecture only . . .
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Ad

NodeJS.ppt

  • 1.  A JavaScript runtime environment running Google Chrome’s V8 engine ◦ a.k.a. a server-side solution for JS ◦ Compiles JS, making it really fast  Runs over the command line  Designed for high concurrency ◦ Without threads or new processes  Never blocks, not even for I/O  Uses the CommonJS framework ◦ Making it a little closer to a real OO language
  • 2.  Instead of threads Node uses an event loop with a stack  Alleviates overhead of context switching
  • 3. Threads Asynchronous Event-driven Lock application / request with listener-workers threads only one thread, which repeatedly fetches an event Using incoming-request model Using queue and then processes it multithreaded server might block the request which might involve multiple events manually saves state and then goes on to process the next event Using context switching no contention and no context switches Using multithreading environments where listener and workers threads are used frequently to take an incoming- request lock Using asynchronous I/O facilities (callbacks, not poll/select or O_NONBLOCK) environments
  • 4.  Request for “index.html” comes in  Stack unwinds and ev_loop goes to sleep  File loads from disk and is sent to the client
  • 5.  Servers do nothing but I/O ◦ Scripts waiting on I/O requests degrades performance  To avoid blocking, Node makes use of the event driven nature of JS by attaching callbacks to I/O requests  Scripts waiting on I/O waste no space because they get popped off the stack when their non-I/O related code finishes executing
  • 7.  Use of JS on both the client and server-side should remove need to “context switch” ◦ Client-side JS makes heavy use of the DOM, no access to files/databases ◦ Server-side JS deals mostly in files/databases, no DOM  JSDom project for Node works for simple tasks, but not much else
  • 8. 1. It's fast 2. It can handle tons of concurrent requests 3. It's written in JavaScript (which means you can use the same code server side and client side) Platform Number of request per second PHP ( via Apache) 3187,27 Static ( via Apache ) 2966,51 Node.js 5569,30
  • 9.  http://nodejs.org/  http://nodejs.org/cinco_de_node.pdf  http://ajaxian.com/archives/google-chrome- chromium-and-v8  http://blog.chromium.org/2010/12/new- crankshaft-for-v8.html  http://news.softpedia.com/news/IE9-RC-vs- Chrome-10-9-vs-Opera-11-vs-Firefox-11- Performance-Comparison-183973.shtml