SlideShare a Scribd company logo
1 of 22
Download to read offline
NODE.JS INTRO
A Talk By Ioseb Dzmanashvili
@iosebi

Wednesday, December 25, 13
ABOUT ME

Software Architect at AzRy LLC
Assistant Professor at CST
Ph.D Student at Technical University of
Georgia
V8 Contributor

Wednesday, December 25, 13
ABOUT NODE.JS

Released in 2009 by Ryan Dahl
Is built on V8 JavaScript Engine
Based on event-driven non-blocking I/O
Platform for fast and scalable network apps

Wednesday, December 25, 13
WHAT MAKES IT AWESOME?
Easy of use
Server side JavaScript
Active community
Repository of awesome modules
npm install [module name]

Wednesday, December 25, 13
SERIOUSLY? IS THAT ALL?

Wednesday, December 25, 13
WELL, NO
Built on V8 JavaScript engine
Node.js never blocks on I/O operations
You do not need to manage threads
No expensive context switching
No memory waste on execution stacks

Wednesday, December 25, 13
V8 ADVANTAGES
Fastest JavaScript runtime
No JIT, it compiles JavaScript into
Assembler
Short(really short) garbage collector cycles
Great implementation of EcmaScript 5 and
EcmaScript 6

Wednesday, December 25, 13
MAJOR BOTTLENECKS

I/O operations (Disk, RAM, Network)
Threaded concurrency

Wednesday, December 25, 13
I/O LATENCY
I/O
L1-Cache

3

L2-Cache

14

RAM

250

Hard Disk

41.000.000

Network

Wednesday, December 25, 13

CPU Cycles

240.000.000
WHAT CONTRIBUTES TO
LATENCY?

Wednesday, December 25, 13
TYPICAL CODE EXAMPLE
var query = "SELECT * FROM t";
var result = db.query(query);
while(result.hasNext()) {
print(result.next());
}
db.free(result);

Wednesday, December 25, 13
NON BLOCKING EXAMPLE
var query = "SELECT * FROM t";
db.query(query, function(result) {
while(result.hasNext()) {
print(result.next());
}
});
// do something here

Wednesday, December 25, 13
FILE I/O EXAMPLE
$file = fopen("file.txt", "r");
while(!feof($file)){
$line = fgets($file);
// do something with line
}
fclose($file);

Wednesday, December 25, 13
ASYNC I/O WITH FILES
function readFile(file) {
var br = new BufferedReader(file, ...);
br.on("error", function(error) {
// handle error
}).on("line", function(line) {
// do something meaningful with line
}).on("end", function() {
// we are done
}).read();
}
readFile("/path/to/file");
Wednesday, December 25, 13
HOW NODE.JS SOLVES I/O
PROBLEMS FOR ME?

Wednesday, December 25, 13
SINGLE THREADED

1
Wednesday, December 25, 13
EVENT LOOP

Single
Thread

Wednesday, December 25, 13
PROGRAM EXECUTION
FLOW
fn0();

I/O is handled
asynchronously

Wednesday, December 25, 13

fn1();

NETWORK I/O

fn2();

FS I/O

fn3();

Program never waits for I/
O operations completion

DB I/O

FS I/O
DISADVANTAGES?

Wednesday, December 25, 13
IT IS JAVASCRIPT

Wednesday, December 25, 13
QUESTIONS?

Wednesday, December 25, 13
THANK YOU

Wednesday, December 25, 13

More Related Content

Similar to იოსებ ძმანაშვილი Node.js

Capacity Management from Flickr
Capacity Management from FlickrCapacity Management from Flickr
Capacity Management from Flickr
xlight
 

Similar to იოსებ ძმანაშვილი Node.js (20)

Chef - Configuration Management for the Cloud
Chef - Configuration Management for the CloudChef - Configuration Management for the Cloud
Chef - Configuration Management for the Cloud
 
JavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java DevelopersJavaOne 2013 - Clojure for Java Developers
JavaOne 2013 - Clojure for Java Developers
 
Front-end development automation with Grunt
Front-end development automation with GruntFront-end development automation with Grunt
Front-end development automation with Grunt
 
Cd syd
Cd sydCd syd
Cd syd
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debris
 
Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB Guru
 
Infrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / PuppetInfrastructure as Code with Chef / Puppet
Infrastructure as Code with Chef / Puppet
 
JavaScript DOM Manipulations
JavaScript DOM ManipulationsJavaScript DOM Manipulations
JavaScript DOM Manipulations
 
Frits Hoogland - About multiblock reads
Frits Hoogland - About multiblock readsFrits Hoogland - About multiblock reads
Frits Hoogland - About multiblock reads
 
StORM preview
StORM previewStORM preview
StORM preview
 
A false digital alibi on mac os x
A false digital alibi on mac os xA false digital alibi on mac os x
A false digital alibi on mac os x
 
Backbone
BackboneBackbone
Backbone
 
Introduction to Node.js: perspectives from a Drupal dev
Introduction to Node.js: perspectives from a Drupal devIntroduction to Node.js: perspectives from a Drupal dev
Introduction to Node.js: perspectives from a Drupal dev
 
Rapid Home Provisioning
Rapid Home ProvisioningRapid Home Provisioning
Rapid Home Provisioning
 
Capacity Management from Flickr
Capacity Management from FlickrCapacity Management from Flickr
Capacity Management from Flickr
 
PL-4047, Big Data Workload Analysis Using SWAT and Ipython Notebooks, by Moni...
PL-4047, Big Data Workload Analysis Using SWAT and Ipython Notebooks, by Moni...PL-4047, Big Data Workload Analysis Using SWAT and Ipython Notebooks, by Moni...
PL-4047, Big Data Workload Analysis Using SWAT and Ipython Notebooks, by Moni...
 
Scala in hulu's data platform
Scala in hulu's data platformScala in hulu's data platform
Scala in hulu's data platform
 
CouchDB
CouchDBCouchDB
CouchDB
 
Troubleshooting Live Java Web Applications
Troubleshooting Live Java Web ApplicationsTroubleshooting Live Java Web Applications
Troubleshooting Live Java Web Applications
 
What Ops Can Learn From Design
What Ops Can Learn From DesignWhat Ops Can Learn From Design
What Ops Can Learn From Design
 

More from unihack

More from unihack (6)

შოთა გიორგობიანი - More than Code
შოთა გიორგობიანი - More than Codeშოთა გიორგობიანი - More than Code
შოთა გიორგობიანი - More than Code
 
როგორ ვერ გავხდი $მილიონერი$
როგორ ვერ გავხდი $მილიონერი$როგორ ვერ გავხდი $მილიონერი$
როგორ ვერ გავხდი $მილიონერი$
 
Hack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programingHack@macs 2014 test driven development & pair programing
Hack@macs 2014 test driven development & pair programing
 
ალექსანდრე ნემსაძე - Release it
ალექსანდრე ნემსაძე - Release itალექსანდრე ნემსაძე - Release it
ალექსანდრე ნემსაძე - Release it
 
იოსებ ძმანაშვილი - The Web APIs
იოსებ ძმანაშვილი - The Web APIsიოსებ ძმანაშვილი - The Web APIs
იოსებ ძმანაშვილი - The Web APIs
 
შოთა გიორგობიანი It's all about having fun
შოთა გიორგობიანი   It's all about having funშოთა გიორგობიანი   It's all about having fun
შოთა გიორგობიანი It's all about having fun
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 

იოსებ ძმანაშვილი Node.js