SlideShare a Scribd company logo
1 of 16
Introduction to
Node.js
How does it work? What makes it different? When would you use

it? And most importantly, why does it matter?

Girish
Gangadharan

@appoosa
What is Node.js?
Development platform

Event-

Non-blocking I/O

driven

model

Built on Chrome's JavaScript

engine

“Node.js is lightweight and efficient which makes it perfect
for building fast, scalable network applications that run

across distributed devices.”
Wait a minute….

Umm…not
really.
JavaScript on the server

JavaScript was supposed to
be a server-side language as
well.
Netscape Enterprise Server

“ Netscape Enterprise Server 2.0 is the first web server to
support the Java(TM) and JavaScript(TM) programming
languages, enabling the creation, delivery and management of
live online applications.

”(March
1996)

Source: http://www.thefreelibrary.com/NETSCAPE+INTRODUCES+NETSCAPE+ENTERPRISE+SERVER(TM)+2.0-a018056425
Traditional web servers

Anyway, let’s see how web servers work
currently…
Current setup
Request 1

Thread 1

…

Request 2

Thread 2

…

Request n

Typically
….
Each request to a traditional web
server gets handed over to a
thread (picked from a limited
thread pool) for processing.

Thread m

(m < n)
(for a busy site, m could be a fraction of n)
How does it scale?

So if there are 10,000 requests
coming in at the same time, and
each requires executing a longrunning task (DB
transactions, network I/O, etc.) ….
How does node.js address it?

So what does node.js bring to the table?

Single thread processing.
And how does it work?
behind the
scenes

Source: http://www.aaronstannard.com/post/2011/12/14/Intro-to-NodeJS-for-NET-Developers.aspx
Simple “hello world” app
hello-world app in
node.js
// Load the http module to create an http server.
var http = require('http');
// Configure the HTTP server.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello, world");
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(3000);
// Log message to the terminal
console.log("Server running at http://127.0.0.1:3000/");
Demo

Let’s write some code.
What makes it different?
It’s JavaScript! (everybody know JavaScript,
right?)
Single threaded (avoid concurrency issues)
(single threaded out of the box, but still supports multi-threading)

Super efficient (can handle 100s of 1000s of
connections/minute)
Great for real-time applications (because of low latency)
Vibrant community (15,000+ packages)
And….it’s FREE! (no licensing costs, no expensive dev
tools)
Why does it matter?
It matters because just like with any other
technology, Node.js is not perfect.
Don’t start using it because it’s new and
shiny.
for example, it’s not the best solution for CPU intensive requests
processing

We don’t need another bubble.
When should you use it?
Multi user, real time apps
- mobile games, collaboration tools, chat rooms, etc.

APIs exposing JSON based DBs
- no need to do any JSON conversion (since it’s JavaScript)

Data Streaming
- Can process files as they’re still being uploaded (using
Streams)

Single page apps

- AJAX heavy apps can benefit from node’s low response
times
We’re done

Questions
?

Girish
Gangadharan

@appoosa

More Related Content

What's hot

Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of us
Gaetano Giunta
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
Sang Cù
 
Webconf nodejs-production-architecture
Webconf nodejs-production-architectureWebconf nodejs-production-architecture
Webconf nodejs-production-architecture
Ben Lin
 

What's hot (20)

Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Node.js tutoria for beginner
Node.js tutoria for beginnerNode.js tutoria for beginner
Node.js tutoria for beginner
 
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
 
Welcome to ClojureScript
Welcome to ClojureScriptWelcome to ClojureScript
Welcome to ClojureScript
 
Ez Content Staging for the rest of us
Ez Content Staging for the rest of usEz Content Staging for the rest of us
Ez Content Staging for the rest of us
 
Node intro
Node introNode intro
Node intro
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Mern stack
Mern stackMern stack
Mern stack
 
Nodejs - Building a RESTful API
Nodejs - Building a RESTful APINodejs - Building a RESTful API
Nodejs - Building a RESTful API
 
Node.js on Azure
Node.js on AzureNode.js on Azure
Node.js on Azure
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Webconf nodejs-production-architecture
Webconf nodejs-production-architectureWebconf nodejs-production-architecture
Webconf nodejs-production-architecture
 
Node js beginner
Node js beginnerNode js beginner
Node js beginner
 
Nodejs
NodejsNodejs
Nodejs
 
Frontend Track NodeJS
Frontend Track NodeJSFrontend Track NodeJS
Frontend Track NodeJS
 
Node js
Node jsNode js
Node js
 
ClojureScript@node
ClojureScript@nodeClojureScript@node
ClojureScript@node
 
What is Node.js
What is Node.jsWhat is Node.js
What is Node.js
 
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime WebGeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 

Viewers also liked

Designing better-ux-workshop-3
Designing better-ux-workshop-3Designing better-ux-workshop-3
Designing better-ux-workshop-3
girish82
 
Designing better-ux-workshop-5
Designing better-ux-workshop-5Designing better-ux-workshop-5
Designing better-ux-workshop-5
girish82
 
Why we need to hire UX professionals
Why we need to hire UX professionalsWhy we need to hire UX professionals
Why we need to hire UX professionals
girish82
 
Designing better-ux-workshop-4
Designing better-ux-workshop-4Designing better-ux-workshop-4
Designing better-ux-workshop-4
girish82
 
Designing better-ux-workshop-2
Designing better-ux-workshop-2Designing better-ux-workshop-2
Designing better-ux-workshop-2
girish82
 
Designing better-ux
Designing better-uxDesigning better-ux
Designing better-ux
girish82
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
girish82
 

Viewers also liked (7)

Designing better-ux-workshop-3
Designing better-ux-workshop-3Designing better-ux-workshop-3
Designing better-ux-workshop-3
 
Designing better-ux-workshop-5
Designing better-ux-workshop-5Designing better-ux-workshop-5
Designing better-ux-workshop-5
 
Why we need to hire UX professionals
Why we need to hire UX professionalsWhy we need to hire UX professionals
Why we need to hire UX professionals
 
Designing better-ux-workshop-4
Designing better-ux-workshop-4Designing better-ux-workshop-4
Designing better-ux-workshop-4
 
Designing better-ux-workshop-2
Designing better-ux-workshop-2Designing better-ux-workshop-2
Designing better-ux-workshop-2
 
Designing better-ux
Designing better-uxDesigning better-ux
Designing better-ux
 
jQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't KnowjQuery - 10 Time-Savers You (Maybe) Don't Know
jQuery - 10 Time-Savers You (Maybe) Don't Know
 

Similar to Introduction to node

01 overview-servlets-and-environment-setup
01 overview-servlets-and-environment-setup01 overview-servlets-and-environment-setup
01 overview-servlets-and-environment-setup
dhrubo kayal
 
Docker intro
Docker introDocker intro
Docker intro
spiddy
 

Similar to Introduction to node (20)

HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQLHTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
 
Node js
Node jsNode js
Node js
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talk
 
Proposal
ProposalProposal
Proposal
 
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
 
HTTP Plugin for MySQL!
HTTP Plugin for MySQL!HTTP Plugin for MySQL!
HTTP Plugin for MySQL!
 
JAX London 2015: Java vs Nodejs
JAX London 2015: Java vs NodejsJAX London 2015: Java vs Nodejs
JAX London 2015: Java vs Nodejs
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Java vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris BaileyJava vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris Bailey
 
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredevNodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
 
Nodejs
NodejsNodejs
Nodejs
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Building Hopsworks, a cloud-native managed feature store for machine learning
Building Hopsworks, a cloud-native managed feature store for machine learning Building Hopsworks, a cloud-native managed feature store for machine learning
Building Hopsworks, a cloud-native managed feature store for machine learning
 
Node.js 101 with Rami Sayar
Node.js 101 with Rami SayarNode.js 101 with Rami Sayar
Node.js 101 with Rami Sayar
 
01 overview-servlets-and-environment-setup
01 overview-servlets-and-environment-setup01 overview-servlets-and-environment-setup
01 overview-servlets-and-environment-setup
 
Nodejs
NodejsNodejs
Nodejs
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
Docker intro
Docker introDocker intro
Docker intro
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Introduction to node

  • 1. Introduction to Node.js How does it work? What makes it different? When would you use it? And most importantly, why does it matter? Girish Gangadharan @appoosa
  • 2. What is Node.js? Development platform Event- Non-blocking I/O driven model Built on Chrome's JavaScript engine “Node.js is lightweight and efficient which makes it perfect for building fast, scalable network applications that run across distributed devices.”
  • 4. JavaScript on the server JavaScript was supposed to be a server-side language as well.
  • 5. Netscape Enterprise Server “ Netscape Enterprise Server 2.0 is the first web server to support the Java(TM) and JavaScript(TM) programming languages, enabling the creation, delivery and management of live online applications. ”(March 1996) Source: http://www.thefreelibrary.com/NETSCAPE+INTRODUCES+NETSCAPE+ENTERPRISE+SERVER(TM)+2.0-a018056425
  • 6. Traditional web servers Anyway, let’s see how web servers work currently…
  • 7. Current setup Request 1 Thread 1 … Request 2 Thread 2 … Request n Typically …. Each request to a traditional web server gets handed over to a thread (picked from a limited thread pool) for processing. Thread m (m < n) (for a busy site, m could be a fraction of n)
  • 8. How does it scale? So if there are 10,000 requests coming in at the same time, and each requires executing a longrunning task (DB transactions, network I/O, etc.) ….
  • 9. How does node.js address it? So what does node.js bring to the table? Single thread processing.
  • 10. And how does it work? behind the scenes Source: http://www.aaronstannard.com/post/2011/12/14/Intro-to-NodeJS-for-NET-Developers.aspx
  • 11. Simple “hello world” app hello-world app in node.js // Load the http module to create an http server. var http = require('http'); // Configure the HTTP server. var server = http.createServer(function (request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.end("Hello, world"); }); // Listen on port 8000, IP defaults to 127.0.0.1 server.listen(3000); // Log message to the terminal console.log("Server running at http://127.0.0.1:3000/");
  • 13. What makes it different? It’s JavaScript! (everybody know JavaScript, right?) Single threaded (avoid concurrency issues) (single threaded out of the box, but still supports multi-threading) Super efficient (can handle 100s of 1000s of connections/minute) Great for real-time applications (because of low latency) Vibrant community (15,000+ packages) And….it’s FREE! (no licensing costs, no expensive dev tools)
  • 14. Why does it matter? It matters because just like with any other technology, Node.js is not perfect. Don’t start using it because it’s new and shiny. for example, it’s not the best solution for CPU intensive requests processing We don’t need another bubble.
  • 15. When should you use it? Multi user, real time apps - mobile games, collaboration tools, chat rooms, etc. APIs exposing JSON based DBs - no need to do any JSON conversion (since it’s JavaScript) Data Streaming - Can process files as they’re still being uploaded (using Streams) Single page apps - AJAX heavy apps can benefit from node’s low response times