SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler 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

Mais conteúdo relacionado

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

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

Semelhante a იოსებ ძმანაშვილი 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
 

Mais de unihack

Mais de 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
 

Último

+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@
 

Último (20)

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
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
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
 
+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...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

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