SlideShare une entreprise Scribd logo
1  sur  26
Intro to Node.js
Amy Hua
Agenda
What is Node.js?
What is non-blocking I/O?
When should you use Node?
Node vs Ruby on Rails
What is Node.js? | summary
• is a command-line tool that can be run as a regular web server and
lets one run Javascript programs
• utilizes the very fast V8 Javascript engine built in Google Chrome
• is very good when you need to do several things at the same time
• is event-based so all the wonderful Ajax like stuff can be done on
the server side
• lets us share code between the browser and the backend
Source: http://stackoverflow.com/questions/5062614/how-to-decide-when-to-use-nodejs
What is Node.js? | summary
• InfoWorld Technology of the Year Award (2012)
• 2nd most popular repo on Github
What is Node.js?
“Node is Javascript on the
server…done right”
“Javascript everywhere”
Sounds confusing:
• Node is not written in Javascript
• It is written in C++, but developers interact with Node
through the look and feel of Javascript
• ~20,000 lines of C++
• ~20,000 lines of Javascript
• Asynchronous server model
What is Node.js?
Node is a set of libraries written on top of Chrome‟s V8
Javascript Engine.
What is the V8 Javascript Engine?
• A Javascript engine is software that interprets & executes Javascript.
• V8 Javascript Engine is written in C++ (and so is Node) and is
extremely fast at running Javascript.
What is Node.js?
Announced in 2009, founded by Ryan Dahl.
Ryan Dahl originally built Node out of frustrations with
trying to build web servers in Ruby.
What is Node.js?
Extremely young.
• 2009: Ryan Dahl announced Node.js
• 2010: became somewhat stable
• 11/2011: “stuff works in windows”
• 6/2012: “stuff works better”
Node is still changing
What is Node.js?
Node.js demonstrates “how I/O should be done”
– Ryan Dahl
What is I/O?
What is Node.js?
event-driven, non-blocking I/O model
What is Node.js? | I/O models
Blocking I/O Model
Example: ways in which a server can process orders from
customers
Hi, my name is
Apache. How may
I take your order?
• The server serves one
customer at a time.
• As each customer is
deciding on their order, the
server sits and waits.
• When the customer decides
on an order, the server
processes their order and
moves on to the next
customer.
What is Node.js? | non-blocking I/O
Blocking I/O Model
Hmm… still
thinking...
OMG she’s blocking
me. I could have
ordered by now.
What is Node.js? | non-blocking I/O
Blocking I/O Model
Hmm… still
thinking...
OMG she’s blocking
me. I could have
ordered by now. Pseudocode:
order1 = db.query(“SELECT *
FROM menu WHERE preference =
most”)
order1.process
order2.process
What is Node.js? | non-blocking I/O
Blocking I/O Model
The more customers you want
to serve at once, the more
cashier lines you‟ll need.
Cashier lines ~ threads in
computing
Multi-threaded processing
Parallel code execution
Multiple CPUs run at a time,
utilizing shared resources
(memory)
What is Node.js? | non-blocking I/O
Non-Blocking I/O Model
I’m still thinking, but
callback to me when
I’m done.While he’s
thinking, I’ll
order the
salmon.
• Node loops through the
customers and polls them to
determine which ones are
ready to order.
• During a function‟s
queue, Node can listen to
another event.
• When the other customer is
finally ready to order, he‟ll
issue a callback.
• Asynchronous callbacks:
“come back to me when I’m
finished”
• function called at the
completion of a given
task.
What is Node.js? | non-blocking I/O
Non-Blocking I/O Model
I’m still thinking, but
callback to me when
I’m done.While he’s
thinking, I’ll
order the
salmon.
Node code
console.log(„Hello‟);
setTimeout(function () {
console.log(„World‟);
}, 5000);
console.log(„Bye‟);
// Outputs:
// Hello
// Bye
// World
Allows for high
concurrency
What is Node.js? | non-blocking I/O
Non-Blocking I/O Model
I’m still thinking, but
callback to me when
I’m done.While he’s
thinking, I’ll
order the
salmon.
Every function in Node
is non-blocking
Single-threaded
No parallel code
execution
Single CPU
What is Node.js? | non-blocking I/O
Node is great for
applications with high
concurrency
(Concurrency =
number of concurrent
clients or users)
What is Node.js? | non-blocking I/O
nginx: non-blocking I/O
apache: blocking I/O
Agenda
What is Node.js?
What is non-blocking I/O?
When should you use Node?
Node vs Ruby on Rails
When should you use Node?
Should you always use Node?
When should you use Node?
No
When should you use Node?
Use Node when:
cost of I/O > cost of more difficult to write code
Cons:
• Not useful for when I/O is light, CPU usage is high (e.g.,
video encoding software)
• Still very barebones, not a powerful framework yet
• You live on Mars
• can‟t utilize any code or libraries in the blocking-I/O world (or else
risk hanging your whole application)
Agenda
What is Node.js?
What is non-blocking I/O?
When should you use Node?
Node vs Ruby on Rails
Node.js vs Rails
Node.js Ruby on Rails
• Server framework. Requires
Express.js or Mongoose, etc.
• One language: Javascript (and all
of its pros and cons)
• Low-level, barebones framework
with freeform MVC. Requires
custom configuration of modules,
views, and helpers. Handpicking
over default configurations.
• Code sharing between server-side
and client-side JS processes
• Still evolving libraries and tools,
developing ecosystem
• No rapid prototyping
• Web framework
• Ruby, Javascript, SQL
• Full package, many built-in
functions, more out of the box
framework
• “Convention over Configuration” –
spend less time on
configuration, more on actual code
• Utilizes best practices
• Robust sources of libraries and
tools, large ecosystem
• Rapid prototyping
Questions

Contenu connexe

Tendances

Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Expressjguerrero999
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsjacekbecela
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven ProgrammingKamal Hussain
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.jsConFoo
 
Getting started with developing Nodejs
Getting started with developing NodejsGetting started with developing Nodejs
Getting started with developing NodejsPhil Hawksworth
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
node.js and native code extensions by example
node.js and native code extensions by examplenode.js and native code extensions by example
node.js and native code extensions by examplePhilipp Fehre
 
A million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleA million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleTom Croucher
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejsAmit Thakkar
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Christian Joudrey
 

Tendances (20)

Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
NodeJS
NodeJSNodeJS
NodeJS
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.js
 
Getting started with developing Nodejs
Getting started with developing NodejsGetting started with developing Nodejs
Getting started with developing Nodejs
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Node.js
Node.jsNode.js
Node.js
 
node.js and native code extensions by example
node.js and native code extensions by examplenode.js and native code extensions by example
node.js and native code extensions by example
 
A million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleA million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scale
 
Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 

En vedette

Directi Campus Recruitment (BizDev)
Directi Campus Recruitment (BizDev)Directi Campus Recruitment (BizDev)
Directi Campus Recruitment (BizDev)Directi Group
 
Async IO and Multithreading explained
Async IO and Multithreading explainedAsync IO and Multithreading explained
Async IO and Multithreading explainedDirecti Group
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation Systemsmozgkarakaya
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OGeorge Cao
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingSteve Rhoades
 
Basel Agenda 2016 during the Life Science Week 2016
Basel Agenda 2016 during the Life Science Week 2016Basel Agenda 2016 during the Life Science Week 2016
Basel Agenda 2016 during the Life Science Week 2016Aleksandar Ruzicic
 
El calendario escolar 2013 2014 república dominicana
El calendario escolar 2013 2014 república dominicanaEl calendario escolar 2013 2014 república dominicana
El calendario escolar 2013 2014 república dominicanaRosenda Castillo
 
6 Apps Para Mejorar Tu Android Rendimiento del Teléfono
6 Apps Para Mejorar Tu Android Rendimiento del Teléfono6 Apps Para Mejorar Tu Android Rendimiento del Teléfono
6 Apps Para Mejorar Tu Android Rendimiento del Teléfonomegacelulares12
 
Migraciones 3 ° A
Migraciones 3 ° AMigraciones 3 ° A
Migraciones 3 ° Adruiz123
 
Presentacion campamento verano la enseñanza 2013
Presentacion campamento verano la enseñanza  2013Presentacion campamento verano la enseñanza  2013
Presentacion campamento verano la enseñanza 2013mstudy-now
 
Instituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - PeruInstituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - PeruInstituto Paul Muller
 
Social CaseHistory Forum 2012 - Email marketing e social media
Social CaseHistory Forum 2012 - Email marketing e social mediaSocial CaseHistory Forum 2012 - Email marketing e social media
Social CaseHistory Forum 2012 - Email marketing e social mediaContactlab
 
Llista targeta pp_blava
Llista targeta pp_blavaLlista targeta pp_blava
Llista targeta pp_blavaPere Piris
 

En vedette (20)

Directi Campus Recruitment (BizDev)
Directi Campus Recruitment (BizDev)Directi Campus Recruitment (BizDev)
Directi Campus Recruitment (BizDev)
 
Async IO and Multithreading explained
Async IO and Multithreading explainedAsync IO and Multithreading explained
Async IO and Multithreading explained
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Recommendation Systems
Recommendation SystemsRecommendation Systems
Recommendation Systems
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/O
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time Messaging
 
Anemias
AnemiasAnemias
Anemias
 
Smics2012 brochure
Smics2012 brochureSmics2012 brochure
Smics2012 brochure
 
Basel Agenda 2016 during the Life Science Week 2016
Basel Agenda 2016 during the Life Science Week 2016Basel Agenda 2016 during the Life Science Week 2016
Basel Agenda 2016 during the Life Science Week 2016
 
El calendario escolar 2013 2014 república dominicana
El calendario escolar 2013 2014 república dominicanaEl calendario escolar 2013 2014 república dominicana
El calendario escolar 2013 2014 república dominicana
 
Neguko gida2014
Neguko gida2014Neguko gida2014
Neguko gida2014
 
6 Apps Para Mejorar Tu Android Rendimiento del Teléfono
6 Apps Para Mejorar Tu Android Rendimiento del Teléfono6 Apps Para Mejorar Tu Android Rendimiento del Teléfono
6 Apps Para Mejorar Tu Android Rendimiento del Teléfono
 
Migraciones 3 ° A
Migraciones 3 ° AMigraciones 3 ° A
Migraciones 3 ° A
 
Presentacion campamento verano la enseñanza 2013
Presentacion campamento verano la enseñanza  2013Presentacion campamento verano la enseñanza  2013
Presentacion campamento verano la enseñanza 2013
 
Equal pay day essay contest 2016
Equal pay day essay contest 2016Equal pay day essay contest 2016
Equal pay day essay contest 2016
 
Instituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - PeruInstituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - Peru
 
Intro to Social Media
Intro to Social MediaIntro to Social Media
Intro to Social Media
 
Social CaseHistory Forum 2012 - Email marketing e social media
Social CaseHistory Forum 2012 - Email marketing e social mediaSocial CaseHistory Forum 2012 - Email marketing e social media
Social CaseHistory Forum 2012 - Email marketing e social media
 
Llista targeta pp_blava
Llista targeta pp_blavaLlista targeta pp_blava
Llista targeta pp_blava
 
Los entornos digitales de enseñanza y aprendizaje
Los entornos digitales de enseñanza y aprendizajeLos entornos digitales de enseñanza y aprendizaje
Los entornos digitales de enseñanza y aprendizaje
 

Similaire à Intro to node and non blocking io

Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
"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
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in JavaLukas Steinbrecher
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-introVu Hung Nguyen
 
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.js
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.jsSfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.js
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.jsVu Hung Nguyen
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdfBareen Shaikh
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
Quick introduction to nodeJs
Quick introduction to nodeJsQuick introduction to nodeJs
Quick introduction to nodeJsAram Rafeq
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sailsBrian Shannon
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksHengki Sihombing
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.jsvaluebound
 

Similaire à Intro to node and non blocking io (20)

NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
"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)
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Nodejs
NodejsNodejs
Nodejs
 
A first look into the Project Loom in Java
A first look into the Project Loom in JavaA first look into the Project Loom in Java
A first look into the Project Loom in Java
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-intro
 
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.js
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.jsSfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.js
Sfd2012Hanoi Nguyễn Hà Dương - Introduction to Node.js
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Quick introduction to nodeJs
Quick introduction to nodeJsQuick introduction to nodeJs
Quick introduction to nodeJs
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 

Dernier

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Dernier (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Intro to node and non blocking io

  • 2. Agenda What is Node.js? What is non-blocking I/O? When should you use Node? Node vs Ruby on Rails
  • 3. What is Node.js? | summary • is a command-line tool that can be run as a regular web server and lets one run Javascript programs • utilizes the very fast V8 Javascript engine built in Google Chrome • is very good when you need to do several things at the same time • is event-based so all the wonderful Ajax like stuff can be done on the server side • lets us share code between the browser and the backend Source: http://stackoverflow.com/questions/5062614/how-to-decide-when-to-use-nodejs
  • 4. What is Node.js? | summary • InfoWorld Technology of the Year Award (2012) • 2nd most popular repo on Github
  • 5. What is Node.js? “Node is Javascript on the server…done right” “Javascript everywhere” Sounds confusing: • Node is not written in Javascript • It is written in C++, but developers interact with Node through the look and feel of Javascript • ~20,000 lines of C++ • ~20,000 lines of Javascript • Asynchronous server model
  • 6. What is Node.js? Node is a set of libraries written on top of Chrome‟s V8 Javascript Engine. What is the V8 Javascript Engine? • A Javascript engine is software that interprets & executes Javascript. • V8 Javascript Engine is written in C++ (and so is Node) and is extremely fast at running Javascript.
  • 7. What is Node.js? Announced in 2009, founded by Ryan Dahl. Ryan Dahl originally built Node out of frustrations with trying to build web servers in Ruby.
  • 8. What is Node.js? Extremely young. • 2009: Ryan Dahl announced Node.js • 2010: became somewhat stable • 11/2011: “stuff works in windows” • 6/2012: “stuff works better” Node is still changing
  • 9. What is Node.js? Node.js demonstrates “how I/O should be done” – Ryan Dahl What is I/O?
  • 10. What is Node.js? event-driven, non-blocking I/O model
  • 11. What is Node.js? | I/O models Blocking I/O Model Example: ways in which a server can process orders from customers Hi, my name is Apache. How may I take your order? • The server serves one customer at a time. • As each customer is deciding on their order, the server sits and waits. • When the customer decides on an order, the server processes their order and moves on to the next customer.
  • 12. What is Node.js? | non-blocking I/O Blocking I/O Model Hmm… still thinking... OMG she’s blocking me. I could have ordered by now.
  • 13. What is Node.js? | non-blocking I/O Blocking I/O Model Hmm… still thinking... OMG she’s blocking me. I could have ordered by now. Pseudocode: order1 = db.query(“SELECT * FROM menu WHERE preference = most”) order1.process order2.process
  • 14. What is Node.js? | non-blocking I/O Blocking I/O Model The more customers you want to serve at once, the more cashier lines you‟ll need. Cashier lines ~ threads in computing Multi-threaded processing Parallel code execution Multiple CPUs run at a time, utilizing shared resources (memory)
  • 15. What is Node.js? | non-blocking I/O Non-Blocking I/O Model I’m still thinking, but callback to me when I’m done.While he’s thinking, I’ll order the salmon. • Node loops through the customers and polls them to determine which ones are ready to order. • During a function‟s queue, Node can listen to another event. • When the other customer is finally ready to order, he‟ll issue a callback. • Asynchronous callbacks: “come back to me when I’m finished” • function called at the completion of a given task.
  • 16. What is Node.js? | non-blocking I/O Non-Blocking I/O Model I’m still thinking, but callback to me when I’m done.While he’s thinking, I’ll order the salmon. Node code console.log(„Hello‟); setTimeout(function () { console.log(„World‟); }, 5000); console.log(„Bye‟); // Outputs: // Hello // Bye // World Allows for high concurrency
  • 17. What is Node.js? | non-blocking I/O Non-Blocking I/O Model I’m still thinking, but callback to me when I’m done.While he’s thinking, I’ll order the salmon. Every function in Node is non-blocking Single-threaded No parallel code execution Single CPU
  • 18. What is Node.js? | non-blocking I/O Node is great for applications with high concurrency (Concurrency = number of concurrent clients or users)
  • 19. What is Node.js? | non-blocking I/O nginx: non-blocking I/O apache: blocking I/O
  • 20. Agenda What is Node.js? What is non-blocking I/O? When should you use Node? Node vs Ruby on Rails
  • 21. When should you use Node? Should you always use Node?
  • 22. When should you use Node? No
  • 23. When should you use Node? Use Node when: cost of I/O > cost of more difficult to write code Cons: • Not useful for when I/O is light, CPU usage is high (e.g., video encoding software) • Still very barebones, not a powerful framework yet • You live on Mars • can‟t utilize any code or libraries in the blocking-I/O world (or else risk hanging your whole application)
  • 24. Agenda What is Node.js? What is non-blocking I/O? When should you use Node? Node vs Ruby on Rails
  • 25. Node.js vs Rails Node.js Ruby on Rails • Server framework. Requires Express.js or Mongoose, etc. • One language: Javascript (and all of its pros and cons) • Low-level, barebones framework with freeform MVC. Requires custom configuration of modules, views, and helpers. Handpicking over default configurations. • Code sharing between server-side and client-side JS processes • Still evolving libraries and tools, developing ecosystem • No rapid prototyping • Web framework • Ruby, Javascript, SQL • Full package, many built-in functions, more out of the box framework • “Convention over Configuration” – spend less time on configuration, more on actual code • Utilizes best practices • Robust sources of libraries and tools, large ecosystem • Rapid prototyping

Notes de l'éditeur

  1. Google V8 Javascript Engine is written in C++Node is a set of libraries on top of V8 to build networking applications.Node has the look and feel of JavascriptNode comes with its own Javascript REPLNode is sugar on top of Google V8
  2. Traditional Way:The server serves one customer at a time.As each customer is deciding on their order, the server sits and waits.When the customer decides on an order, the server processes their order and moves on to the next customer.
  3. Traditional Way:The server serves one customer at a time.As each customer is deciding on their order, the server sits and waits.When the customer decides on an order, the server processes their order and moves on to the next customer.
  4. Traditional Way:The server serves one customer at a time.As each customer is deciding on their order, the server sits and waits.When the customer decides on an order, the server processes their order and moves on to the next customer.
  5. Traditional Way:The server serves one customer at a time.As each customer is deciding on their order, the server sits and waits.When the customer decides on an order, the server processes their order and moves on to the next customer.