SlideShare a Scribd company logo
Node.js
Thomas Amsler
June 14, 2012
GDG Sacramento
Node
●Created by Ryan Dahl in 2009. First
presented at JSConf EU.
●Node is a platform built on Chrome's V8
JavaScript runtime for easily building fast,
scalable network applications.
●Node uses an event-driven, non-blocking I/O
model that makes it lightweight and efficient.
●Node is for data-intensive real-time
applications that run across distributed
devices.
Node ...
●Server Side JavaScript
●Built on Google's V8 Runtime
●Non-blocking I/O (Asynchronous)
●Evented (Event Loop)
●Module System
●Native on Linux, Mac OS X, Windows
●Enables Real-time Web
●It's all about LATENCY
History
●Netscape LiveWire (1996)
●Rhino (1997) [for Java]
●Aptana Jaxer (2008)
●RingoJS [for Java]
●Narwhale
●Node.js (2009)
●IronJS [for .NET]
Synchronous vs Asynchronous
I/O is not free
●L1: 3 cycles
●L2: 14 cycles
●RAM: 250 cycles
●DISK: 41,000,000 cycles
●NETWORK: 240,000,000 cycles
http://duartes.org/gustavo/blog/post/what-your-computer-
does-while-you-wait
Blocking I/O (Sync)
<?php
echo "Hello";
file_get_contents("/path/to/file");
echo " World";
?>
Threads
●Each Thread takes memory
●Threads introduce additional complexity
oRace conditions
oDeadlock
oAdditional setup overhead
o...
Non-blocking I/O (Async)
console.log('Hello');
fs.readFile('/path/to/file', function(err, data) {
// do something ...
});
console.log(' World');
Event Loop
●Efficient (if used asynchronously)
●Only one stack
●No memory overhead
●Simpler model (no deadlocks, no race
conditions ...)
The C10K Problem
●C10K refers to the problem of optimizing a
web server to handle a large number of
clients at the same time.
●C = CONCURRENT
●Apache uses one thread per connection
●NGINX doesn't use multiple threads but
instead uses an event loop
●NGINX and Node.js are similar with respect
to utilizing an event loop to achieve high
concurrency on low latency
The C10K Problem ...
●C = Concurrent
●http://www.kegel.com/c10k.html
http://blog.webfaction.com/a-little-holiday-present
The C10K Problem ...
●Using one thread per connection is memory-
bound
http://blog.webfaction.com/a-little-holiday-present
... back to Node.js ...
Why JavaScript?
●JS devs already think asynchronously
(Browsers + AJAX)
●JS is fast and getting faster
●JS quickly is becoming a compilation target
o https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-
compile-to-JS
●Code sharing between the client and server
o Maybe common libs ...
●JSON native and full application stack
o MongoDB, Node.js, Angular.js
Google's V8 JavaScript Engine
●V8 is a JavaScript engine specifically
designed for fast execution of large
JavaScript applications
●Used in Google's Chrome browser
●Written in C++
●Fast property access
●Dynamic machine code generation
●Efficient garbage collection
● https://developers.google.com/v8/
● http://blog.chromium.org/2012/05/better-code-optimization-decisions-
for.html
The Node.js Darkside
●Still relatively young
●Bad idea to do raw computation in an event
loop. Use node-webworker
●Debugging is hard but will significantly
improve in future versions
●Callbacks (not really an issue)
doA( argA, function() {
doB(argB, function() {
doC(argC, function() {
// etc.
});
});
});
Node Package Manager (NPM)
●NPM is a package manager for node. You
can use it to install and publish your node
programs. It manages dependencies and
does other cool stuff.
●http://npmjs.org/
●http://search.npmjs.org/
o Express
o Request
o Socket.io (LearnBoost)
o Jade
o ... 10k + more ...
Node Package Manager (NPM) ...
Node Core
(V8, libev, libeio, ...)
Core Modules
(http, net, ...)
Community-created Modules
(express, socket.io, restify, ...)
Let's Node
●Read Evaluate Print Loop (REPL)
oSimilar to Perl, Python, and Ruby
●It's great for testing out and learning about
Node.js
●Since Node.js uses V8, Node REPL is an
ideal place to easily try out and learn
JavaScript
●DEMO
First Node Server
var http = require('http');
var s = http.createServer( function(req, res) {
res.writeHead( 200, { 'Content-Type' : 'text/plain' } );
res.end('Hello Worldn');
});
s.listen(8080);
●curl http://localhost:8080/
●curl -i -X GET http://localhost:8080/
●DEMO
Load Test & Profiling
●Using Apache Bench (ab) for Simple Load
Testing
oab -n 200 -c 200 http://127.0.0.1:8080/
●Profiling Node.js
o http://dtrace.org/blogs/dap/2012/04/25/profiling-node-js/
Node.js Information
●API
ohttp://nodejs.org/api
●SRC
ohttps://github.com/joyent/node
●How To Node
ohttp://howtonode.org
●StackOverflow
ohttp://stackoverflow.com/questions/tagged/node.js
●Projects & Companies using Node.js
ohttp://goo.gl/Wcqtj
Other Resources
●Introduction to Node.js with Ryan Dahl
ohttp://youtu.be/jo_B4LTHi3I
●The Node Beginner Book
ohttp://www.nodebeginner.org
●Ryan Dahl - History of Node.js
ohttp://youtu.be/SAc0vQCC6UQ
●What is Node? (Free)
ohttp://shop.oreilly.com/product/0636920021506.do
●Ryan Dahl's 2009 slides
ohttp://s3.amazonaws.com/four.livejournal/20091117/j
sconf.pdf

More Related Content

What's hot

Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012JooinK
 
Javascript integration (3)
Javascript integration (3)Javascript integration (3)
Javascript integration (3)cookpadtech
 
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
Igalia
 
Web technologies for desktop development
Web technologies for desktop developmentWeb technologies for desktop development
Web technologies for desktop developmentDarko Kukovec
 
Introduction to javascript technologies
Introduction to javascript technologiesIntroduction to javascript technologies
Introduction to javascript technologies
Abdalla Elsayed
 
BKK16-209 Chromium with V4L2 playback - is it ready today?
BKK16-209 Chromium with V4L2 playback - is it ready today?BKK16-209 Chromium with V4L2 playback - is it ready today?
BKK16-209 Chromium with V4L2 playback - is it ready today?
Linaro
 
20121102 ceph-in-the-cloud
20121102 ceph-in-the-cloud20121102 ceph-in-the-cloud
20121102 ceph-in-the-cloudCeph Community
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and Qt
ICS
 
Smashing the bottleneck: Qt application profiling
Smashing the bottleneck: Qt application profilingSmashing the bottleneck: Qt application profiling
Smashing the bottleneck: Qt application profiling
Develer S.r.l.
 
ChakraCore is what?
ChakraCore is what?ChakraCore is what?
ChakraCore is what?
Nakajima Shigeru
 
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Publicis Sapient Engineering
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime
 
What is Node JS ?
What is Node JS ?What is Node JS ?
What is Node JS ?
Balajihope
 
Sergey Shamruk - Building Project From Scratch
Sergey Shamruk - Building Project From ScratchSergey Shamruk - Building Project From Scratch
Sergey Shamruk - Building Project From Scratch
Flash Conference
 
Truck truck is a rust cad kernel
Truck   truck is a rust cad kernelTruck   truck is a rust cad kernel
Truck truck is a rust cad kernel
YoshinoriTanimura
 
Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10
David Ashton
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
Johannes Rudolph
 
Dockerfile for rust project
Dockerfile for rust projectDockerfile for rust project
Dockerfile for rust project
Hien Nguyen
 

What's hot (20)

Web&mobile - 4 ottobre 2012
Web&mobile  - 4 ottobre 2012Web&mobile  - 4 ottobre 2012
Web&mobile - 4 ottobre 2012
 
Javascript integration (3)
Javascript integration (3)Javascript integration (3)
Javascript integration (3)
 
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
Improving Chromium's code health: Onion Soup and beyond (BlinkOn 11)
 
Web technologies for desktop development
Web technologies for desktop developmentWeb technologies for desktop development
Web technologies for desktop development
 
Introduction to javascript technologies
Introduction to javascript technologiesIntroduction to javascript technologies
Introduction to javascript technologies
 
BKK16-209 Chromium with V4L2 playback - is it ready today?
BKK16-209 Chromium with V4L2 playback - is it ready today?BKK16-209 Chromium with V4L2 playback - is it ready today?
BKK16-209 Chromium with V4L2 playback - is it ready today?
 
20121102 ceph-in-the-cloud
20121102 ceph-in-the-cloud20121102 ceph-in-the-cloud
20121102 ceph-in-the-cloud
 
State of the Art OpenGL and Qt
State of the Art OpenGL and QtState of the Art OpenGL and Qt
State of the Art OpenGL and Qt
 
Smashing the bottleneck: Qt application profiling
Smashing the bottleneck: Qt application profilingSmashing the bottleneck: Qt application profiling
Smashing the bottleneck: Qt application profiling
 
ChakraCore is what?
ChakraCore is what?ChakraCore is what?
ChakraCore is what?
 
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
 
ngconf2015
ngconf2015ngconf2015
ngconf2015
 
What is Node JS ?
What is Node JS ?What is Node JS ?
What is Node JS ?
 
Sergey Shamruk - Building Project From Scratch
Sergey Shamruk - Building Project From ScratchSergey Shamruk - Building Project From Scratch
Sergey Shamruk - Building Project From Scratch
 
Truck truck is a rust cad kernel
Truck   truck is a rust cad kernelTruck   truck is a rust cad kernel
Truck truck is a rust cad kernel
 
Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10
 
Angular2 - A story from the trenches
Angular2 - A story from the trenchesAngular2 - A story from the trenches
Angular2 - A story from the trenches
 
Dockerfile for rust project
Dockerfile for rust projectDockerfile for rust project
Dockerfile for rust project
 
Retour JavaOne 2009
Retour JavaOne 2009Retour JavaOne 2009
Retour JavaOne 2009
 

Viewers also liked

Mise en scene planning
Mise en scene planningMise en scene planning
Mise en scene planning
bantersquadstudios2
 
Mise – en – scene plan - luke
Mise – en – scene plan - lukeMise – en – scene plan - luke
Mise – en – scene plan - luke
bantersquadstudios2
 
Mise en-scene planning - Harry
Mise en-scene planning - Harry Mise en-scene planning - Harry
Mise en-scene planning - Harry
bantersquadstudios2
 
Bantersquadstudios1 pitch
Bantersquadstudios1   pitchBantersquadstudios1   pitch
Bantersquadstudios1 pitch
bantersquadstudios2
 
Carbon Fiber Reinforcement OR Carbocrete and its Types
Carbon Fiber Reinforcement OR Carbocrete and its TypesCarbon Fiber Reinforcement OR Carbocrete and its Types
Carbon Fiber Reinforcement OR Carbocrete and its Types
Naqeeb Khan Niazi
 
Carbon Fiber Reinforcement OR Carbocrete
Carbon Fiber Reinforcement OR CarbocreteCarbon Fiber Reinforcement OR Carbocrete
Carbon Fiber Reinforcement OR Carbocrete
Naqeeb Khan Niazi
 

Viewers also liked (7)

VINODH KUMAR(IND)
VINODH KUMAR(IND)VINODH KUMAR(IND)
VINODH KUMAR(IND)
 
Mise en scene planning
Mise en scene planningMise en scene planning
Mise en scene planning
 
Mise – en – scene plan - luke
Mise – en – scene plan - lukeMise – en – scene plan - luke
Mise – en – scene plan - luke
 
Mise en-scene planning - Harry
Mise en-scene planning - Harry Mise en-scene planning - Harry
Mise en-scene planning - Harry
 
Bantersquadstudios1 pitch
Bantersquadstudios1   pitchBantersquadstudios1   pitch
Bantersquadstudios1 pitch
 
Carbon Fiber Reinforcement OR Carbocrete and its Types
Carbon Fiber Reinforcement OR Carbocrete and its TypesCarbon Fiber Reinforcement OR Carbocrete and its Types
Carbon Fiber Reinforcement OR Carbocrete and its Types
 
Carbon Fiber Reinforcement OR Carbocrete
Carbon Fiber Reinforcement OR CarbocreteCarbon Fiber Reinforcement OR Carbocrete
Carbon Fiber Reinforcement OR Carbocrete
 

Similar to Node.js Test

Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
Arjun Sreekumar
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
Nodejs
NodejsNodejs
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
Dinesh U
 
Node js vs golang -which one is better ?
Node js vs golang -which one is better ?Node js vs golang -which one is better ?
Node js vs golang -which one is better ?
ForceBolt
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
Exist
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
Manuel Carrasco Moñino
 
Nodejs
NodejsNodejs
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
Ahmed Elbassel
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
Gobinda Karmakar ☁
 
SunGrid: Cloud Computing
SunGrid: Cloud ComputingSunGrid: Cloud Computing
SunGrid: Cloud Computing
Uday Subbarayan
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
valuebound
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
F5 Buddy
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript Performance
Intel® Software
 
Intro to node.js
Intro to node.jsIntro to node.js
Intro to node.js
Sunil Kumar Singh
 
Post mortem talk - Node Interactive EU
Post mortem talk - Node Interactive EUPost mortem talk - Node Interactive EU
Post mortem talk - Node Interactive EU
Michael Dawson
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
mfrancis
 
Ext GWT - Overview and Implementation Case Study
Ext GWT - Overview and Implementation Case StudyExt GWT - Overview and Implementation Case Study
Ext GWT - Overview and Implementation Case Study
Avi Perez
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 

Similar to Node.js Test (20)

Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Nodejs
NodejsNodejs
Nodejs
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Node js vs golang -which one is better ?
Node js vs golang -which one is better ?Node js vs golang -which one is better ?
Node js vs golang -which one is better ?
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
Nodejs
NodejsNodejs
Nodejs
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
SunGrid: Cloud Computing
SunGrid: Cloud ComputingSunGrid: Cloud Computing
SunGrid: Cloud Computing
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
 
The Next Leap in JavaScript Performance
The Next Leap in JavaScript PerformanceThe Next Leap in JavaScript Performance
The Next Leap in JavaScript Performance
 
Intro to node.js
Intro to node.jsIntro to node.js
Intro to node.js
 
Post mortem talk - Node Interactive EU
Post mortem talk - Node Interactive EUPost mortem talk - Node Interactive EU
Post mortem talk - Node Interactive EU
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
Ext GWT - Overview and Implementation Case Study
Ext GWT - Overview and Implementation Case StudyExt GWT - Overview and Implementation Case Study
Ext GWT - Overview and Implementation Case Study
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 

Recently uploaded

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
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
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
 
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
 
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
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
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
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
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
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
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
 

Recently uploaded (20)

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
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
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
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
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...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
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
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
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...
 

Node.js Test

  • 1. Node.js Thomas Amsler June 14, 2012 GDG Sacramento
  • 2. Node ●Created by Ryan Dahl in 2009. First presented at JSConf EU. ●Node is a platform built on Chrome's V8 JavaScript runtime for easily building fast, scalable network applications. ●Node uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. ●Node is for data-intensive real-time applications that run across distributed devices.
  • 3. Node ... ●Server Side JavaScript ●Built on Google's V8 Runtime ●Non-blocking I/O (Asynchronous) ●Evented (Event Loop) ●Module System ●Native on Linux, Mac OS X, Windows ●Enables Real-time Web ●It's all about LATENCY
  • 4. History ●Netscape LiveWire (1996) ●Rhino (1997) [for Java] ●Aptana Jaxer (2008) ●RingoJS [for Java] ●Narwhale ●Node.js (2009) ●IronJS [for .NET]
  • 6. I/O is not free ●L1: 3 cycles ●L2: 14 cycles ●RAM: 250 cycles ●DISK: 41,000,000 cycles ●NETWORK: 240,000,000 cycles http://duartes.org/gustavo/blog/post/what-your-computer- does-while-you-wait
  • 7. Blocking I/O (Sync) <?php echo "Hello"; file_get_contents("/path/to/file"); echo " World"; ?>
  • 8. Threads ●Each Thread takes memory ●Threads introduce additional complexity oRace conditions oDeadlock oAdditional setup overhead o...
  • 9. Non-blocking I/O (Async) console.log('Hello'); fs.readFile('/path/to/file', function(err, data) { // do something ... }); console.log(' World');
  • 10. Event Loop ●Efficient (if used asynchronously) ●Only one stack ●No memory overhead ●Simpler model (no deadlocks, no race conditions ...)
  • 11. The C10K Problem ●C10K refers to the problem of optimizing a web server to handle a large number of clients at the same time. ●C = CONCURRENT ●Apache uses one thread per connection ●NGINX doesn't use multiple threads but instead uses an event loop ●NGINX and Node.js are similar with respect to utilizing an event loop to achieve high concurrency on low latency
  • 12. The C10K Problem ... ●C = Concurrent ●http://www.kegel.com/c10k.html http://blog.webfaction.com/a-little-holiday-present
  • 13. The C10K Problem ... ●Using one thread per connection is memory- bound http://blog.webfaction.com/a-little-holiday-present
  • 14. ... back to Node.js ...
  • 15. Why JavaScript? ●JS devs already think asynchronously (Browsers + AJAX) ●JS is fast and getting faster ●JS quickly is becoming a compilation target o https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that- compile-to-JS ●Code sharing between the client and server o Maybe common libs ... ●JSON native and full application stack o MongoDB, Node.js, Angular.js
  • 16. Google's V8 JavaScript Engine ●V8 is a JavaScript engine specifically designed for fast execution of large JavaScript applications ●Used in Google's Chrome browser ●Written in C++ ●Fast property access ●Dynamic machine code generation ●Efficient garbage collection ● https://developers.google.com/v8/ ● http://blog.chromium.org/2012/05/better-code-optimization-decisions- for.html
  • 17. The Node.js Darkside ●Still relatively young ●Bad idea to do raw computation in an event loop. Use node-webworker ●Debugging is hard but will significantly improve in future versions ●Callbacks (not really an issue) doA( argA, function() { doB(argB, function() { doC(argC, function() { // etc. }); }); });
  • 18. Node Package Manager (NPM) ●NPM is a package manager for node. You can use it to install and publish your node programs. It manages dependencies and does other cool stuff. ●http://npmjs.org/ ●http://search.npmjs.org/ o Express o Request o Socket.io (LearnBoost) o Jade o ... 10k + more ...
  • 19. Node Package Manager (NPM) ... Node Core (V8, libev, libeio, ...) Core Modules (http, net, ...) Community-created Modules (express, socket.io, restify, ...)
  • 20. Let's Node ●Read Evaluate Print Loop (REPL) oSimilar to Perl, Python, and Ruby ●It's great for testing out and learning about Node.js ●Since Node.js uses V8, Node REPL is an ideal place to easily try out and learn JavaScript ●DEMO
  • 21. First Node Server var http = require('http'); var s = http.createServer( function(req, res) { res.writeHead( 200, { 'Content-Type' : 'text/plain' } ); res.end('Hello Worldn'); }); s.listen(8080); ●curl http://localhost:8080/ ●curl -i -X GET http://localhost:8080/ ●DEMO
  • 22. Load Test & Profiling ●Using Apache Bench (ab) for Simple Load Testing oab -n 200 -c 200 http://127.0.0.1:8080/ ●Profiling Node.js o http://dtrace.org/blogs/dap/2012/04/25/profiling-node-js/
  • 23. Node.js Information ●API ohttp://nodejs.org/api ●SRC ohttps://github.com/joyent/node ●How To Node ohttp://howtonode.org ●StackOverflow ohttp://stackoverflow.com/questions/tagged/node.js ●Projects & Companies using Node.js ohttp://goo.gl/Wcqtj
  • 24. Other Resources ●Introduction to Node.js with Ryan Dahl ohttp://youtu.be/jo_B4LTHi3I ●The Node Beginner Book ohttp://www.nodebeginner.org ●Ryan Dahl - History of Node.js ohttp://youtu.be/SAc0vQCC6UQ ●What is Node? (Free) ohttp://shop.oreilly.com/product/0636920021506.do ●Ryan Dahl's 2009 slides ohttp://s3.amazonaws.com/four.livejournal/20091117/j sconf.pdf