SlideShare una empresa de Scribd logo
1 de 10
By: Craig Hecock
What is NodeJS?
   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
Concurrency: The Event
Loop
 Instead of threads Node uses an event loop with a
  stack
 Alleviates overhead of context switching
Event Loop Example
 Request for “index.html” comes in
 Stack unwinds and ev_loop goes to sleep
 File loads from disk and is sent to the client
Non-blocking I/O
   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
I/O Example
Drawbacks
   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
Conclusion
 Still in beta
 Non-blocking nature takes some getting used to
 Interesting API

    ◦ Can almost remake Dash!
References
 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
References
 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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Node js - Enterprise Class
Node js - Enterprise ClassNode js - Enterprise Class
Node js - Enterprise Class
 
Nodejs basics
Nodejs basicsNodejs basics
Nodejs basics
 
Node js projects
Node js projectsNode js projects
Node js projects
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Node js Global Packages
Node js Global PackagesNode js Global Packages
Node js Global Packages
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
NodeJS
NodeJSNodeJS
NodeJS
 
Node js training (1)
Node js training (1)Node js training (1)
Node js training (1)
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
NodeJS
NodeJSNodeJS
NodeJS
 
Node.js an introduction
Node.js   an introductionNode.js   an introduction
Node.js an introduction
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
 
Node Session - 1
Node Session - 1Node Session - 1
Node Session - 1
 
Node
NodeNode
Node
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 

Destacado (17)

Athabasca University [infographic]
Athabasca University [infographic]Athabasca University [infographic]
Athabasca University [infographic]
 
Apec women and the economy 2011 mo - australia
Apec women and the economy 2011   mo - australiaApec women and the economy 2011   mo - australia
Apec women and the economy 2011 mo - australia
 
Photoshop
PhotoshopPhotoshop
Photoshop
 
Big data
Big dataBig data
Big data
 
Berkeley Data Analytics Stack Genel Bakış
Berkeley Data Analytics Stack Genel Bakış Berkeley Data Analytics Stack Genel Bakış
Berkeley Data Analytics Stack Genel Bakış
 
An example of cms - wordpress
An example of cms - wordpressAn example of cms - wordpress
An example of cms - wordpress
 
Trilo ACTIVE QUIZ
Trilo ACTIVE QUIZTrilo ACTIVE QUIZ
Trilo ACTIVE QUIZ
 
Istqb ctfl syll 2011
Istqb ctfl syll 2011Istqb ctfl syll 2011
Istqb ctfl syll 2011
 
Clojure 1a
Clojure 1aClojure 1a
Clojure 1a
 
Fischer GmbH Russisch
Fischer GmbH RussischFischer GmbH Russisch
Fischer GmbH Russisch
 
481 bb0091
481 bb0091481 bb0091
481 bb0091
 
Higher Education: Is Web Self-Service Right for You
Higher Education: Is Web Self-Service Right for YouHigher Education: Is Web Self-Service Right for You
Higher Education: Is Web Self-Service Right for You
 
Gaji pp 22 tnh 2013
Gaji pp 22 tnh 2013Gaji pp 22 tnh 2013
Gaji pp 22 tnh 2013
 
The best!
The best!The best!
The best!
 
Colab42
Colab42Colab42
Colab42
 
Exp int toc
Exp int tocExp int toc
Exp int toc
 
Branding highlights2002b
Branding highlights2002bBranding highlights2002b
Branding highlights2002b
 

Similar a Node js

NodeJS introduction and examples of event loops
NodeJS introduction and examples of event loopsNodeJS introduction and examples of event loops
NodeJS introduction and examples of event loopsLalith86
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDDSudar Muthu
 
An introduction to Node.js application development
An introduction to Node.js application developmentAn introduction to Node.js application development
An introduction to Node.js application developmentshelloidhq
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js PresentationExist
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsArtur Cistov
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)Tech in Asia ID
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersRob Tweed
 
Introduction to Performance APIs
Introduction to Performance APIsIntroduction to Performance APIs
Introduction to Performance APIsShogo Sensui
 

Similar a Node js (20)

NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS.ppt
NodeJS.pptNodeJS.ppt
NodeJS.ppt
 
NodeJS introduction and examples of event loops
NodeJS introduction and examples of event loopsNodeJS introduction and examples of event loops
NodeJS introduction and examples of event loops
 
Node.js
Node.jsNode.js
Node.js
 
Nodejs
NodejsNodejs
Nodejs
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 
Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Docker How and Why
Docker How and WhyDocker How and Why
Docker How and Why
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
An introduction to Node.js application development
An introduction to Node.js application developmentAn introduction to Node.js application development
An introduction to Node.js application development
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js Developers
 
Introduction to Performance APIs
Introduction to Performance APIsIntroduction to Performance APIs
Introduction to Performance APIs
 

Más de Krishna Chaytaniah

Más de Krishna Chaytaniah (8)

Sortsearch
SortsearchSortsearch
Sortsearch
 
Linear sorting
Linear sortingLinear sorting
Linear sorting
 
Introduction to writing algorithms
Introduction to writing algorithmsIntroduction to writing algorithms
Introduction to writing algorithms
 
Design and analysis of computer algorithms (dave mount, 1999)
Design and analysis of computer algorithms (dave mount, 1999)Design and analysis of computer algorithms (dave mount, 1999)
Design and analysis of computer algorithms (dave mount, 1999)
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
 
Writing algorithms
Writing algorithmsWriting algorithms
Writing algorithms
 
Oracle apps
Oracle appsOracle apps
Oracle apps
 
Salesforce content best_practices_rollout_webinar_deck
Salesforce content best_practices_rollout_webinar_deckSalesforce content best_practices_rollout_webinar_deck
Salesforce content best_practices_rollout_webinar_deck
 

Node js

  • 2. What is NodeJS?  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
  • 3. Concurrency: The Event Loop  Instead of threads Node uses an event loop with a stack  Alleviates overhead of context switching
  • 4. Event Loop Example  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. Non-blocking I/O  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. Drawbacks  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. Conclusion  Still in beta  Non-blocking nature takes some getting used to  Interesting API ◦ Can almost remake Dash!
  • 9. References  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
  • 10. References  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