SlideShare a Scribd company logo
21.02.2017
Fatih Şimşek - Software Infrastructure
NodeJs
Open Source, cross platform
Huge community
Ryan Dahl, Joyent
Developed in 2009
Published in 2011 ( Linux + Windows )
Similar design to systems like Ruby's Event Machine or
Python's Twisted
Who is using NodeJs?
Success Stories
Yahoo: Node services handle around 1.680.000 – 2.000.000
requests/minute. Biggest Win: speed & ease of developement
Netflix: The team decided to use Node.js to achieve lightweight,
modular and fast application. As a result, the startup time of
their new app has been reduced by 70%
Linkedin: When compared with the previous Ruby on Rails
based version, the new mobile app is up to 20 times faster
Walmart: %55 of all traffic on Black Friday went to Node
servers. Not a single Node server went down
Success Stories
PayPal: Build a Node version of a Java app in half the time with
fewer developers. Node version of the app doubled the number
of requests/second. Request time dropped 35%
Groupon: In comparison with earlier Ruby on Rails platform,
web pages got faster by about 50% and are able to serve much
higher traffic
GoDaddy: 10x fewer servers to host our customer websites and
we reduced the Time To First Byte (TTFB) considerably from
~60ms to something around ~12ms
Github
NodeJs
Built on Chrome’s Javascript Runtime (V8)
Single thread, event oriented
Event-Driven with Non-blocking I/O
Use a Event Loop for Non-blocking I/O
Can handle thousands of concurrent connections with minimal
overhead (CPU/Memory)
40% JS and 60% C++
Traditional Server
New thread per request
The thread is blocked
during IO operations
Thesis
IO is expensive
Thread per connection
is memory expensive
Architecture
Client
Event loop
(main thread)
C++
Threadpool
(worker
threads)
Clients send HTTP requests
to Node.js server
An Event-loop is woken up by OS,
passes request and response objects
to the thread-pool
Long-running jobs run
on worker threads
Response is sent
back to main thread
via callback
Event loop returns
result to client
Architecture
API in Javascript
Relies on Google’s V8
runtime engine
Node Bindings allow for
server operations (IO,
network)
Libuv responsible for both
asynchronous I/O & event
loop
When to use NodeJs?
Highly Event driven & Heavily I/O bound
Chat application
Online game
Collaboration tool
Monitoring Dashboard
Trader’s Dashboard
When not to use NodeJs?
Heavy CPU intensive calculations on server-side
Concurrent Task based applications
Install
https://nodejs.org/en/download/
node –v (Node version)
Developement Environment
Web Storm
Sublime Text
Atom
Nodeclipse
Visual Studio
Visual Studio Code
DEMO
Node Frameworks & Tools
NPM (Package Manager)
Gulp / Grunt
Express.js
Frameworks built on Express.js (LoopBack / MEAN / Sails)
Restify
Mongoose
Socket.io
NPM
Package manager for Node
Bundled and installed automatically with the environment
Frequently Usage
• npm install --save package_name
• npm update
How Does it works?
• Read package.json
• Installs the dependencies in the local node_modules folder
• In global modes, it make a node module accessible to all
Express.js
Web application framework
Minimal and Flexible
Many Framework based on Express
Features
• MVC
• Routing
• Session Support
• Cookie Parsing
• Middleware (Request-Response Cycle)
• View Engines (Jade, Ejs, Vash)
Vash
Familiar Razor engine experience
No special template syntax to learn
Syntax:
Mongoose
Object Data Modelling for Node.js
Officially supported by 10gen,Inc
Features:
• Async and sync validation of models
• Model casting
• Object lifecycle management (hook save / validate)
• Query Builder
• Schema Deriven Design
DEMO
Node js
EventEmitter
Most of built-in Node libraries use it
Use Observer Pattern
Socket.io
Realtime application framework
Cross browser (Web socket + fallback)
Bi-directional communication
Automatic compression
IOS, Android, NativeScript support
Two parts
• Client side (run on browser)
• Server side (run on Node)
DEMO
Benchmark
Benchmark
Node js

More Related Content

What's hot (20)

PPTX
Introduction to Node.js
AMD Developer Central
 
PPTX
Node js Introduction
sanskriti agarwal
 
PDF
WEB DEVELOPMENT USING REACT JS
MuthuKumaran Singaravelu
 
PPTX
React JS part 1
Diluka Wittahachchige
 
PPT
Node js Modules and Event Emitters
TheCreativedev Blog
 
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
PDF
Nodejs vatsal shah
Vatsal N Shah
 
PDF
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
PPTX
Mongoose and MongoDB 101
Will Button
 
PDF
Introduction to Node.js
Rob O'Doherty
 
PPTX
introduction to node.js
orkaplan
 
PPTX
NodeJS guide for beginners
Enoch Joshua
 
PDF
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
 
PPTX
Introduction Node.js
Erik van Appeldoorn
 
PPT
Node.js Express Framework
TheCreativedev Blog
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
PDF
Fundamental of Node.JS - Internship Presentation - Week7
Devang Garach
 
PPTX
Intro to React
Justin Reock
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
.Net Core
Bertrand Le Roy
 
Introduction to Node.js
AMD Developer Central
 
Node js Introduction
sanskriti agarwal
 
WEB DEVELOPMENT USING REACT JS
MuthuKumaran Singaravelu
 
React JS part 1
Diluka Wittahachchige
 
Node js Modules and Event Emitters
TheCreativedev Blog
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
Nodejs vatsal shah
Vatsal N Shah
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Mongoose and MongoDB 101
Will Button
 
Introduction to Node.js
Rob O'Doherty
 
introduction to node.js
orkaplan
 
NodeJS guide for beginners
Enoch Joshua
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
 
Introduction Node.js
Erik van Appeldoorn
 
Node.js Express Framework
TheCreativedev Blog
 
NodeJS for Beginner
Apaichon Punopas
 
Fundamental of Node.JS - Internship Presentation - Week7
Devang Garach
 
Intro to React
Justin Reock
 
Introduction to Node.js
Vikash Singh
 
.Net Core
Bertrand Le Roy
 

Similar to Node js (20)

PPTX
Proposal
Constantine Priemski
 
PPT
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
PPTX
Nodejs
Vinod Kumar Marupu
 
PPTX
Beginners Node.js
Khaled Mosharraf
 
ODP
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
PPT
Introducción y comandos en NodeJS slodte
lmcsenatic
 
PDF
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
PPTX
Introduction to node.js by jiban
Jibanananda Sana
 
PPT
18_Node.js.ppt
KhalilSalhi7
 
PPT
18_Node.js.ppt
MaulikShah516542
 
PPT
Node
Manav Prasad
 
PPTX
An overview of node.js
valuebound
 
PPTX
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
PDF
Why Node.js
guileen
 
PDF
Why Nodejs Guilin Shanghai
Jackson Tian
 
PDF
Introduction to Node.js
Aaron Rosenberg
 
PPTX
Definitive Guide to Powerful Nodejs Development.pptx
75waytechnologies
 
PDF
Node.js for beginner
Sarunyhot Suwannachoti
 
PPTX
Node Session - 1
Bhavin Shah
 
PPTX
Intro to node and non blocking io
Amy Hua
 
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
Beginners Node.js
Khaled Mosharraf
 
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
Introducción y comandos en NodeJS slodte
lmcsenatic
 
Tech io nodejs_20130531_v0.6
Ganesh Kondal
 
Introduction to node.js by jiban
Jibanananda Sana
 
18_Node.js.ppt
KhalilSalhi7
 
18_Node.js.ppt
MaulikShah516542
 
An overview of node.js
valuebound
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Why Node.js
guileen
 
Why Nodejs Guilin Shanghai
Jackson Tian
 
Introduction to Node.js
Aaron Rosenberg
 
Definitive Guide to Powerful Nodejs Development.pptx
75waytechnologies
 
Node.js for beginner
Sarunyhot Suwannachoti
 
Node Session - 1
Bhavin Shah
 
Intro to node and non blocking io
Amy Hua
 
Ad

Recently uploaded (20)

PDF
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
PDF
Virtual Threads in Java: A New Dimension of Scalability and Performance
Tier1 app
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PDF
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
PDF
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
PDF
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
PDF
What companies do with Pharo (ESUG 2025)
ESUG
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PDF
SAP GUI Installation Guide for Windows | Step-by-Step Setup for SAP Access
SAP Vista, an A L T Z E N Company
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
Virtual Threads in Java: A New Dimension of Scalability and Performance
Tier1 app
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Why Are More Businesses Choosing Partners Over Freelancers for Salesforce.pdf
Cymetrix Software
 
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Enhancing Security in VAST: Towards Static Vulnerability Scanning
ESUG
 
What companies do with Pharo (ESUG 2025)
ESUG
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Presentation about variables and constant.pptx
kr2589474
 
SAP GUI Installation Guide for Windows | Step-by-Step Setup for SAP Access
SAP Vista, an A L T Z E N Company
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
Ad

Node js

  • 1. 21.02.2017 Fatih Şimşek - Software Infrastructure
  • 2. NodeJs Open Source, cross platform Huge community Ryan Dahl, Joyent Developed in 2009 Published in 2011 ( Linux + Windows ) Similar design to systems like Ruby's Event Machine or Python's Twisted
  • 3. Who is using NodeJs?
  • 4. Success Stories Yahoo: Node services handle around 1.680.000 – 2.000.000 requests/minute. Biggest Win: speed & ease of developement Netflix: The team decided to use Node.js to achieve lightweight, modular and fast application. As a result, the startup time of their new app has been reduced by 70% Linkedin: When compared with the previous Ruby on Rails based version, the new mobile app is up to 20 times faster Walmart: %55 of all traffic on Black Friday went to Node servers. Not a single Node server went down
  • 5. Success Stories PayPal: Build a Node version of a Java app in half the time with fewer developers. Node version of the app doubled the number of requests/second. Request time dropped 35% Groupon: In comparison with earlier Ruby on Rails platform, web pages got faster by about 50% and are able to serve much higher traffic GoDaddy: 10x fewer servers to host our customer websites and we reduced the Time To First Byte (TTFB) considerably from ~60ms to something around ~12ms
  • 7. NodeJs Built on Chrome’s Javascript Runtime (V8) Single thread, event oriented Event-Driven with Non-blocking I/O Use a Event Loop for Non-blocking I/O Can handle thousands of concurrent connections with minimal overhead (CPU/Memory) 40% JS and 60% C++
  • 8. Traditional Server New thread per request The thread is blocked during IO operations
  • 9. Thesis IO is expensive Thread per connection is memory expensive
  • 10. Architecture Client Event loop (main thread) C++ Threadpool (worker threads) Clients send HTTP requests to Node.js server An Event-loop is woken up by OS, passes request and response objects to the thread-pool Long-running jobs run on worker threads Response is sent back to main thread via callback Event loop returns result to client
  • 11. Architecture API in Javascript Relies on Google’s V8 runtime engine Node Bindings allow for server operations (IO, network) Libuv responsible for both asynchronous I/O & event loop
  • 12. When to use NodeJs? Highly Event driven & Heavily I/O bound Chat application Online game Collaboration tool Monitoring Dashboard Trader’s Dashboard
  • 13. When not to use NodeJs? Heavy CPU intensive calculations on server-side Concurrent Task based applications
  • 15. Developement Environment Web Storm Sublime Text Atom Nodeclipse Visual Studio Visual Studio Code
  • 16. DEMO
  • 17. Node Frameworks & Tools NPM (Package Manager) Gulp / Grunt Express.js Frameworks built on Express.js (LoopBack / MEAN / Sails) Restify Mongoose Socket.io
  • 18. NPM Package manager for Node Bundled and installed automatically with the environment Frequently Usage • npm install --save package_name • npm update How Does it works? • Read package.json • Installs the dependencies in the local node_modules folder • In global modes, it make a node module accessible to all
  • 19. Express.js Web application framework Minimal and Flexible Many Framework based on Express Features • MVC • Routing • Session Support • Cookie Parsing • Middleware (Request-Response Cycle) • View Engines (Jade, Ejs, Vash)
  • 20. Vash Familiar Razor engine experience No special template syntax to learn Syntax:
  • 21. Mongoose Object Data Modelling for Node.js Officially supported by 10gen,Inc Features: • Async and sync validation of models • Model casting • Object lifecycle management (hook save / validate) • Query Builder • Schema Deriven Design
  • 22. DEMO
  • 24. EventEmitter Most of built-in Node libraries use it Use Observer Pattern
  • 25. Socket.io Realtime application framework Cross browser (Web socket + fallback) Bi-directional communication Automatic compression IOS, Android, NativeScript support Two parts • Client side (run on browser) • Server side (run on Node)
  • 26. DEMO

Editor's Notes

  • #3: Ryan is an American freelance programmer living in of Germany. His work invariably involves interruptible parsers, event loops, and response time histograms. He is the creator of several open source projects including the Ebb web server and the "EY" load balancer module for Nginx. Joyent, ABD'nin San Fransisco kenti merkezli yazılım firması.
  • #5: 9 Famous Apps Built with Node.js https://brainhub.eu/blog/2016/05/30/9-famous-apps-using-node-js/
  • #6: 9 Famous Apps Built with Node.js https://brainhub.eu/blog/2016/05/30/9-famous-apps-using-node-js/
  • #11: Single thread to handle callbacks Ideal for waiting for I/O calls (network, filesystem, database) Not ideal for CPU intensive operations -> solution fork new child process No thread management No need to synchronization Creating scalable web servers is easy
  • #12: The request to read the file goes through Node bindings to libuv. Then libuv gives the task of reading the file to a thread. When the thread completes reading the file into the buffer, the results goes to V8 and then through the Node bindings in the form of a callback function. In the callback shown the data argument is a Buffer with the file data.
  • #16: Nodeclipse: Built on Eclipse
  • #17: Single Thread
  • #18: Restify = Rest API comes with automatic DTrace support for all your handlers, if you're running on a platform that supports Dtrace Dtrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time
  • #20: You can set request time before routing on middleware
  • #21: Jade / EJS = http://wildermuth.com/2014/3/24/Choose_Your_Own_Adventure_with_Node_js_View_Engines Vash = https://www.upnxt.com/blog/node-with-express-vash-sqlite http://kirbysayshi.com/2012/04/17/vash.html
  • #22: Table = Collection Record = Document http://www.slideshare.net/yuriybogomolov/ybo-mongo-dbmeetup
  • #23: Sample ExpressJs http://getbootstrap.com/css/#forms http://getbootstrap.com/components/#list-group http://getbootstrap.com/components/#glyphicons-examples
  • #25: You can crete your Node Libraries build on EventEmitter EventEmitter functions : addListener(event, listener) on(event, listener) once(event, listener) removeListener(event, listener) removeAllListeners([event]) setMaxListeners(n) listeners(event) listenerCount(emitter, event)
  • #26: Web socket is not fully supported in all browser yet. İf Web socket is available, we will use it, if it is not, it will try fallback transports until one of them works Fallback tranports: Web sockets Flash sockets Ajax long polling Ajax streaming İframe Json polling
  • #27: Socket.io
  • #28: https://gist.github.com/ilyaigpetrov/f6df3e6f825ae1b5c7e2 https://tipaltilabs.com/2016/07/09/node-js-vs-iis-webapi-async/ OWIN idea on Asp.net after Nodejs
  • #30: http://www.wintellect.com/devcenter/jlane/five-reasons-asp-net-developers-should-care-about-node-js http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx