Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Getting started with node.js @ AngleBrackets 2018
Search
Asim Hussain
March 26, 2018
Programming
1
170
Getting started with node.js @ AngleBrackets 2018
Less getting started and more deep dive into asynchronous non-blocking event-driven programming.
Asim Hussain
March 26, 2018
Tweet
Share
More Decks by Asim Hussain
See All by Asim Hussain
JavaScript Saves The World - DotJS 2019
jawache
0
880
Saving the world, one line at a time [CodeLeaders Australia 2019]
jawache
0
67
YGLF_2019.pdf
jawache
1
120
AI + JavaScript Rocks @ GDGDevFest UA 2018
jawache
0
45
How to hack a web app? WebConfAsia 2018
jawache
0
80
How to scale an SPA? @ AmsterdamJS 2018
jawache
0
24
How to hack an Angular app? - ngConf 2018
jawache
0
880
How to hack an Angular app? @ ngVikings 2018
jawache
1
1.1k
How to hack a python app? @ PyCaribbean 2018
jawache
0
160
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.3k
ヤプリ新卒SREの オンボーディング
masaki12
0
130
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
4
640
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Quine, Polyglot, 良いコード
qnighy
4
640
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Code Reviewing Like a Champion
maltzj
520
39k
Speed Design
sergeychernyshev
24
610
Become a Pro
speakerdeck
PRO
25
5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
What's new in Ruby 2.0
geeforr
343
31k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
88
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Designing for Performance
lara
604
68k
GitHub's CSS Performance
jonrohan
1030
460k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Transcript
Getting started with Node.js @jawache AngleBrackets 2018
Asim Hussain @jawache codecraft.tv microsoft.com @jawache
https://aka.ms/jawache-cda @jawache
@jawache
Agenda @jawache
• What is Node? • Asynchronous vs Synchronous • Asynchronous
Patterns • Event Loop Agenda @jawache
Assumptions @jawache
• Experienced developers • Know JavaScript • Even the new
stuff Assumptions @jawache
What is Node? @jawache
What is V8? @jawache
@jawache https://github.com/v8/v8/wiki
@jawache https://github.com/nodejs/node
@jawache https://nodejs.org
@jawache https://github.com/nodejs/node-chakracore https://github.com/Microsoft/ChakraCore
Async vs Sync @jawache
@jawache Sync is Blocking Async is Non-Blocking
@jawache
@jawache Analyse Text
None
"Blocking is a made up construct" - Asim @jawache
@jawache
@jawache
"Blocking is bad if your app deals with a lot
of I/O" - Asim @jawache
Async Solution #1 @jawache Threads
@jawache
Multi-Threading is Hard! @jawache
Async Solution #2 @jawache Events
Node abstracts all I/O interactions into events that are handled
on an implicit eventloop. @jawache
Node is single threaded * @jawache
@jawache
@jawache JS JS JS
Code doesn't block means there is always something that is
running @jawache
@jawache
Node makes it is easy to write performant code @jawache
Async Patterns @jawache
• setInterval(...) • setTimeout(...) • setImmediate(...) • process.nextTick(...) • readFile(...)
Async Patterns @jawache
Event Loop @jawache
@jawache ⏰ ⚠ setInterval setTimeout I/O setImmediate close JS JS
JS
Macro & Micro Tasks @jawache
@jawache ⏰ ⚠ setInterval setTimeout I/O setImmediate close JS JS
JS JS JS process.nextTick Promises
@jawache ⏰ ⚠ setInterval setTimeout I/O setImmediate close JS JS
JS JS JS
Example @jawache
@jawache
@jawache
Summary @jawache
• Node extends and embeds V8 • Non-blocking is better
for performance • Threads or Events • Async Patterns • Event Loop Summary @jawache
@jawache Node.js in the Enterprise Thurs 9am to 4pm Dan
Wahlin John Papa
Asim Hussain @jawache codecraft.tv microsoft.com
Morning Keynote- Everything You Need to Know About Node.js Event
Loop - Bert Belder, IBM https://www.youtube.com/watch?v=PNa9OMajw9w The Node.js Event Loop, Timers, and process.nextTick() https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/ Understanding the Node.js Event Loop https://nodesource.com/blog/understanding-the-nodejs-event-loop/ Understanding the Node.js Event Loop https://blog.risingstack.com/node-js-at-scale-understanding-node-js-event-loop/ Understanding Node.js Event-Driven Architecture https://medium.freecodecamp.org/understanding-node-js-event-driven-architecture-223292fcbc2d V8 https://github.com/v8/v8 Node https://github.com/nodejs/node