SlideShare une entreprise Scribd logo
1  sur  18
AN INTRODUCTION TO NODE.JS

+ SAILS.JS QUICK DEMO

Meet.js Katowice – 5 lutego 2014 – Kamil PrzeoRski
www.facebook.com/groups/nodejsPL
słowo wstępu

•
•
•
•
•
•
•

teoria node.js
korzyści
wyzwania / problemy
popyt / podaż – potencjalne możliwości kariery :-)
przykłady i najlepsze zastosowania node.js
krótkie demo sails.js
przyszłość node.js ( dyskusja :-)
wydajność I/O
OPERATION CPU CYCLES

300,000,000
240,000,000
225,000,000

150,000,000

75,000,000
41,000,000
3

14

250

L1

0

L2

RAM

Source: Ryan Dahl's 2008.11.08 presentation on Node.js

DISK

NETWORK
waiting ...

ROUTE REQUEST

QUERY DB OR WEB SERVICE

OPERACJE I/O ZAJMUJĄ O WIELE
WIĘCEJ CZASU NIŻ INNE OPERACJE
W TWOJEJ APLIKACJI

PROCESS RESULT

WRITE TO LOG FILE

STANDARDOWE APLIKACJE POSIADAJĄCE
OPERACJE I/O CZEKAJĄ PRZEZ WIĘKSZOŚĆ
CZASU

FORMAL RESPONSE

Source: Ryan Dahl's 2008.11.08
presentation on Node.js
skalowalnie przy użyciu wątków

THREAD 1
THREAD 2
THREAD 3

THREAD 4
Source: Ryan Dahl's 2008.11.08 presentation on Node.js

OBSŁUGA WĄTKÓW PRZEZ
SYSTEM OS JEST “DROGA”

ALOKACJA PAMIĘCI, “CONTEXT SWITCHING”
I CZEKANIE NA WYKONANIE SIĘ OPERACJI
I/O

SZTUCZNE OGRANICZENIE ILOŚCI
JEDNOCZESNYCH POŁĄCZEO
skalowalnie przy użyciu “Event Loop”

PROCESS 1

NETWORK

FILESYSTEM
Thread Pool and Async I/I APIs

JEDEN WĄTEK W CAŁEJ APLIKACJI

DELEGUJE OPERACJE I/O
MECHANIZMOWI “THREADPOOL”

Source: Ryan Dahl's 2008.11.08
presentation on Node.js
event loop

thread pool
event
queue
NODE.JS KORZYSTA
Z BIBLIOTEKI LIBEV DO OBSŁUGI
MECHANIZMU EVENT-LOOP

filesystem

EVENT
LOOP

network
process
other

PO WYKONANIU SIĘ OPERACJI I/O,
ZA POMOCĄ MECHANIZMU “CALLBACK”
WYNIK ZOSTAJE PRZEKAZANY SPOWROTEM
DO GŁÓWNEGO WĄTKU APLIKACJI
Source: Ryan Dahl's 2008.11.08 presentation on Node.js
platforma

•

•
•

V8 JAVASCRIPT VIRTUAL
MACHINE

Java Script

NODE STANDARD LIBRARY
NODE BINDINGS

LIBEIO (THREAD POOL)

LIBEV (EVENT LOOP)

C

V8

Thread
Pool
(libeio)

Event
Loop
(livev)
problemy i wyzwania

thread pool

NIESTABILNE MODUŁY API

TRUDNY W DEBUGOWANIU

event
queue

filesystem

EVENT
LOOP

network
process
other

MAŁO DOŚWIADCZONYCH SPECJALISTÓW
NA RYNKU JEST DODATKOWYM RYZYKIEM
DLA FIRM CHCĄCYCH UŻYWAD NODE.JS
W CELACH KOMERCYJNYCH

0:2
Source: Ryan Dahl's 2008.11.08 presentation on Node.js
popularność
Job trends from indeed.com
NODES

PHP

JAVA

PYTHON

RUBY

.NET

12,000
11,000
10,000

9,000
8,000
7,000
6,000
5,000
4,000
3,000
2,000
1,000

0
Jan ’06

Jan ’07

PONAD 1000 OSÓB
ONLINE NA IRC'U NODE.JS

Jan ’08

Jan ’09

Jan ’10

OGROMNY WZROST
ZAINTERESOWANIA W OSTATNICH 3
LATACH

Jan ’11

Jan ’12

Jan ’13

O WIELE WIĘKSZY POPYT NIŻ PODAŻ W
WIĘKSZYCH HUB'ACH TECHNOLOGICZNYCH
(NP. LONDYN, SAN FRANCISCO)
popularność_2
Module counts
Rubygems.org

PyPl

php

nuget

Node.js

80000
70000
60000
50000
40000
30000
20000
10000

0
Jul 2010

Jan 2011

ILOŚD MODUŁÓW ZWIĘKSZA
SIĘ DRAMATYCZNIE (ŻÓŁTA
LINIA)

Jul 2011

Jan 2012

Jul 2012

POPULARNOŚD NODE.JS W
RASBERRY PI ( INTERNET OF THINGS )

Jan 2013

Jul 2013

Jan 2014

NIESTETY JAKOŚD MODUŁÓW
MA WIELE DO ŻYCZENIA ( POTRZEBA CZASU )
PayPal: Node.js vs. Java
Java application

14

2000

Node.js application

1800

12
1400
10
8

25

1000

20

1000
800

6

800
600

15
600

4

10

400

400
2

200
0

0
1

5

10

Pages/sec

Account response time (ms)

1200

5

200
0

0

15

Pages/sec

1

/home

/wallet

5

10

/activity

15

20

25

Pages/sec

1400

30

1200

1600
PayPal: Node.js vs. Java

PAYPAL'S “ACCOUNT OVERVIEW”

“BUILT ALMOST TWICE AS FAST WITH
FEWER PEOPLE”

“WRITTEN IN 33% FEWER LINES OF CODE”

“CONSTRUCTED WITH 40% FEWER FILES”
estimote ( Kraków,PL )

SZUKAJĄ LUDZI DO BUDOWANIA ICH
API W NODE.JS

ZNALEZIENIE KOGOŚ Z 3 LETNIM DOŚWIADCZENIEM
W NODE.JS JEST NAPRAWDĘ HARDDD W POLSCE... :-)
sails.js

“MVC PATTERN” WZOROWANY
NA ROR'ZE

WSPIERA BUDOWANIE
APLIKACJI RESTOWYCH

SZYBKIE DEMO
Dziękuję :-)
Reach me at kamil.przeorski@skygatedigital.co.uk

Meet.js Katowice – 5 lutego 2014 – Kamil PrzeoRski
www.facebook.com/groups/nodejsPL
An introduction to Node.js and Sails.js at Meet.js Katowice (in polish)

Contenu connexe

Similaire à An introduction to Node.js and Sails.js at Meet.js Katowice (in polish)

SE2016 Exotic Oleg Gorbunov "Action cable"
SE2016 Exotic Oleg Gorbunov "Action cable"SE2016 Exotic Oleg Gorbunov "Action cable"
SE2016 Exotic Oleg Gorbunov "Action cable"Inhacking
 
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemHow APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemCisco DevNet
 
Open Innovation means Open Source
Open Innovation means Open SourceOpen Innovation means Open Source
Open Innovation means Open SourceBertrand Delacretaz
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Mainframe DevOps Using Zowe Open Source
Mainframe DevOps Using Zowe Open SourceMainframe DevOps Using Zowe Open Source
Mainframe DevOps Using Zowe Open SourceDevOps.com
 
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItYou Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItAleksandr Yampolskiy
 
E Snet Raf Essc Jan2005
E Snet Raf Essc Jan2005E Snet Raf Essc Jan2005
E Snet Raf Essc Jan2005FNian
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopJimmy Guerrero
 
A map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummitA map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummitGiulio Vian
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogicRakuten Group, Inc.
 
Open Innovation means Open Source
Open Innovation means Open SourceOpen Innovation means Open Source
Open Innovation means Open SourceBertrand Delacretaz
 
Pulumi iac on gcp
Pulumi iac on gcpPulumi iac on gcp
Pulumi iac on gcpVishwas N
 
Social Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DaySocial Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DayTechMaster Vietnam
 

Similaire à An introduction to Node.js and Sails.js at Meet.js Katowice (in polish) (20)

Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Sql Azure
Sql AzureSql Azure
Sql Azure
 
Node.js
Node.jsNode.js
Node.js
 
Oleg Gorbunov Action cable
Oleg Gorbunov Action cableOleg Gorbunov Action cable
Oleg Gorbunov Action cable
 
SE2016 Exotic Oleg Gorbunov "Action cable"
SE2016 Exotic Oleg Gorbunov "Action cable"SE2016 Exotic Oleg Gorbunov "Action cable"
SE2016 Exotic Oleg Gorbunov "Action cable"
 
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation EcosystemHow APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
How APIs are Transforming Cisco Solutions and Catalyzing an Innovation Ecosystem
 
Open Innovation means Open Source
Open Innovation means Open SourceOpen Innovation means Open Source
Open Innovation means Open Source
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Mainframe DevOps Using Zowe Open Source
Mainframe DevOps Using Zowe Open SourceMainframe DevOps Using Zowe Open Source
Mainframe DevOps Using Zowe Open Source
 
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing ItYou Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
You Too Can Be a Radio Host Or How We Scaled a .NET Startup And Had Fun Doing It
 
Beyond JEE
Beyond JEEBeyond JEE
Beyond JEE
 
E Snet Raf Essc Jan2005
E Snet Raf Essc Jan2005E Snet Raf Essc Jan2005
E Snet Raf Essc Jan2005
 
MSDN Dec2007
MSDN Dec2007MSDN Dec2007
MSDN Dec2007
 
Seattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
 
A map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummitA map for DevOps on Microsoft Stack - MS DevSummit
A map for DevOps on Microsoft Stack - MS DevSummit
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
 
Open Innovation means Open Source
Open Innovation means Open SourceOpen Innovation means Open Source
Open Innovation means Open Source
 
Pulumi iac on gcp
Pulumi iac on gcpPulumi iac on gcp
Pulumi iac on gcp
 
Social Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech DaySocial Photos - My presentation at Microsoft Tech Day
Social Photos - My presentation at Microsoft Tech Day
 

Dernier

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Dernier (20)

Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

An introduction to Node.js and Sails.js at Meet.js Katowice (in polish)

  • 1.
  • 2. AN INTRODUCTION TO NODE.JS + SAILS.JS QUICK DEMO Meet.js Katowice – 5 lutego 2014 – Kamil PrzeoRski www.facebook.com/groups/nodejsPL
  • 3. słowo wstępu • • • • • • • teoria node.js korzyści wyzwania / problemy popyt / podaż – potencjalne możliwości kariery :-) przykłady i najlepsze zastosowania node.js krótkie demo sails.js przyszłość node.js ( dyskusja :-)
  • 4. wydajność I/O OPERATION CPU CYCLES 300,000,000 240,000,000 225,000,000 150,000,000 75,000,000 41,000,000 3 14 250 L1 0 L2 RAM Source: Ryan Dahl's 2008.11.08 presentation on Node.js DISK NETWORK
  • 5. waiting ... ROUTE REQUEST QUERY DB OR WEB SERVICE OPERACJE I/O ZAJMUJĄ O WIELE WIĘCEJ CZASU NIŻ INNE OPERACJE W TWOJEJ APLIKACJI PROCESS RESULT WRITE TO LOG FILE STANDARDOWE APLIKACJE POSIADAJĄCE OPERACJE I/O CZEKAJĄ PRZEZ WIĘKSZOŚĆ CZASU FORMAL RESPONSE Source: Ryan Dahl's 2008.11.08 presentation on Node.js
  • 6. skalowalnie przy użyciu wątków THREAD 1 THREAD 2 THREAD 3 THREAD 4 Source: Ryan Dahl's 2008.11.08 presentation on Node.js OBSŁUGA WĄTKÓW PRZEZ SYSTEM OS JEST “DROGA” ALOKACJA PAMIĘCI, “CONTEXT SWITCHING” I CZEKANIE NA WYKONANIE SIĘ OPERACJI I/O SZTUCZNE OGRANICZENIE ILOŚCI JEDNOCZESNYCH POŁĄCZEO
  • 7. skalowalnie przy użyciu “Event Loop” PROCESS 1 NETWORK FILESYSTEM Thread Pool and Async I/I APIs JEDEN WĄTEK W CAŁEJ APLIKACJI DELEGUJE OPERACJE I/O MECHANIZMOWI “THREADPOOL” Source: Ryan Dahl's 2008.11.08 presentation on Node.js
  • 8. event loop thread pool event queue NODE.JS KORZYSTA Z BIBLIOTEKI LIBEV DO OBSŁUGI MECHANIZMU EVENT-LOOP filesystem EVENT LOOP network process other PO WYKONANIU SIĘ OPERACJI I/O, ZA POMOCĄ MECHANIZMU “CALLBACK” WYNIK ZOSTAJE PRZEKAZANY SPOWROTEM DO GŁÓWNEGO WĄTKU APLIKACJI Source: Ryan Dahl's 2008.11.08 presentation on Node.js
  • 9. platforma • • • V8 JAVASCRIPT VIRTUAL MACHINE Java Script NODE STANDARD LIBRARY NODE BINDINGS LIBEIO (THREAD POOL) LIBEV (EVENT LOOP) C V8 Thread Pool (libeio) Event Loop (livev)
  • 10. problemy i wyzwania thread pool NIESTABILNE MODUŁY API TRUDNY W DEBUGOWANIU event queue filesystem EVENT LOOP network process other MAŁO DOŚWIADCZONYCH SPECJALISTÓW NA RYNKU JEST DODATKOWYM RYZYKIEM DLA FIRM CHCĄCYCH UŻYWAD NODE.JS W CELACH KOMERCYJNYCH 0:2 Source: Ryan Dahl's 2008.11.08 presentation on Node.js
  • 11. popularność Job trends from indeed.com NODES PHP JAVA PYTHON RUBY .NET 12,000 11,000 10,000 9,000 8,000 7,000 6,000 5,000 4,000 3,000 2,000 1,000 0 Jan ’06 Jan ’07 PONAD 1000 OSÓB ONLINE NA IRC'U NODE.JS Jan ’08 Jan ’09 Jan ’10 OGROMNY WZROST ZAINTERESOWANIA W OSTATNICH 3 LATACH Jan ’11 Jan ’12 Jan ’13 O WIELE WIĘKSZY POPYT NIŻ PODAŻ W WIĘKSZYCH HUB'ACH TECHNOLOGICZNYCH (NP. LONDYN, SAN FRANCISCO)
  • 12. popularność_2 Module counts Rubygems.org PyPl php nuget Node.js 80000 70000 60000 50000 40000 30000 20000 10000 0 Jul 2010 Jan 2011 ILOŚD MODUŁÓW ZWIĘKSZA SIĘ DRAMATYCZNIE (ŻÓŁTA LINIA) Jul 2011 Jan 2012 Jul 2012 POPULARNOŚD NODE.JS W RASBERRY PI ( INTERNET OF THINGS ) Jan 2013 Jul 2013 Jan 2014 NIESTETY JAKOŚD MODUŁÓW MA WIELE DO ŻYCZENIA ( POTRZEBA CZASU )
  • 13. PayPal: Node.js vs. Java Java application 14 2000 Node.js application 1800 12 1400 10 8 25 1000 20 1000 800 6 800 600 15 600 4 10 400 400 2 200 0 0 1 5 10 Pages/sec Account response time (ms) 1200 5 200 0 0 15 Pages/sec 1 /home /wallet 5 10 /activity 15 20 25 Pages/sec 1400 30 1200 1600
  • 14. PayPal: Node.js vs. Java PAYPAL'S “ACCOUNT OVERVIEW” “BUILT ALMOST TWICE AS FAST WITH FEWER PEOPLE” “WRITTEN IN 33% FEWER LINES OF CODE” “CONSTRUCTED WITH 40% FEWER FILES”
  • 15. estimote ( Kraków,PL ) SZUKAJĄ LUDZI DO BUDOWANIA ICH API W NODE.JS ZNALEZIENIE KOGOŚ Z 3 LETNIM DOŚWIADCZENIEM W NODE.JS JEST NAPRAWDĘ HARDDD W POLSCE... :-)
  • 16. sails.js “MVC PATTERN” WZOROWANY NA ROR'ZE WSPIERA BUDOWANIE APLIKACJI RESTOWYCH SZYBKIE DEMO
  • 17. Dziękuję :-) Reach me at kamil.przeorski@skygatedigital.co.uk Meet.js Katowice – 5 lutego 2014 – Kamil PrzeoRski www.facebook.com/groups/nodejsPL