SlideShare uma empresa Scribd logo
1 de 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)

Mais conteúdo relacionado

Semelhante a 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
 

Semelhante a 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
 

Último

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 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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)wesley chun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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 WorkerThousandEyes
 
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...Neo4j
 
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 Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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...Martijn de Jong
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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 DevelopmentsTrustArc
 
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 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Último (20)

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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
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...
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

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