SlideShare a Scribd company logo
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

More Related Content

What's hot

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
jguerrero999
 
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
Ganesh 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 backend
David Padbury
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
jacekbecela
 
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 Programming
Kamal 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 Nodejs
Phil Hawksworth
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
William Bruno Moraes
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
Akshay 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
Node.jsNode.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
Philipp 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 nodejs
Amit 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
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
Cere Labs Pvt. Ltd
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
Vatsal N Shah
 

What's hot (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
 

Viewers also liked

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 explained
Directi 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 Engine
Ricardo 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/O
George Cao
 
Asynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time MessagingAsynchronous PHP and Real-time Messaging
Asynchronous PHP and Real-time Messaging
Steve 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 2016
Aleksandar 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 dominicana
Rosenda 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éfono
megacelulares12
 
Migraciones 3 ° A
Migraciones 3 ° AMigraciones 3 ° A
Migraciones 3 ° A
druiz123
 
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
mstudy-now
 
Equal pay day essay contest 2016
Equal pay day essay contest 2016Equal pay day essay contest 2016
Equal pay day essay contest 2016
Equal Pay Day Chicago
 
Instituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - PeruInstituto Superior Paul Muller - Peru
Instituto Superior Paul Muller - Peru
Instituto Paul Muller
 
Intro to Social Media
Intro to Social MediaIntro to Social Media
Intro to Social Media
My Social Media Coach
 
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
Contactlab
 
Llista targeta pp_blava
Llista targeta pp_blavaLlista targeta pp_blava
Llista targeta pp_blava
Pere Piris
 
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
Universidad Abierta Para Adultos (UAPA)
 

Viewers also liked (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
 

Similar to Intro to node and non blocking io

NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
Victor Reyes Heitmann
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
Swapnil Mishra
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
Kalp 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
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
Ahmed Elbassel
 
Nodejs
NodejsNodejs
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
Lukas Steinbrecher
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
mohamed hadrich
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
Arvind Devaraj
 
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.pdf
Bareen Shaikh
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
Quick introduction to nodeJs
Quick introduction to nodeJsQuick introduction to nodeJs
Quick introduction to nodeJs
Aram Rafeq
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Aaron Rosenberg
 
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
Hengki Sihombing
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
valuebound
 

Similar to 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
 

Recently uploaded

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 

Recently uploaded (20)

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

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

Editor's Notes

  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.