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
180
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
900
Saving the world, one line at a time [CodeLeaders Australia 2019]
jawache
0
79
YGLF_2019.pdf
jawache
1
150
AI + JavaScript Rocks @ GDGDevFest UA 2018
jawache
0
52
How to hack a web app? WebConfAsia 2018
jawache
0
93
How to scale an SPA? @ AmsterdamJS 2018
jawache
0
32
How to hack an Angular app? - ngConf 2018
jawache
0
960
How to hack an Angular app? @ ngVikings 2018
jawache
1
1.1k
How to hack a python app? @ PyCaribbean 2018
jawache
0
170
Other Decks in Programming
See All in Programming
Porting a visionOS App to Android XR
akkeylab
0
480
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
130
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
170
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
10 Costly Database Performance Mistakes (And How To Fix Them)
andyatkinson
0
400
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
2
640
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
GPUを計算資源として使おう!
primenumber
1
120
Rails Frontend Evolution: It Was a Setup All Along
skryukov
0
160
テスト駆動Kaggle
isax1015
0
300
XP, Testing and ninja testing
m_seki
3
250
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
190
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
GitHub's CSS Performance
jonrohan
1031
460k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
We Have a Design System, Now What?
morganepeng
53
7.7k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
A designer walks into a library…
pauljervisheath
207
24k
Designing for humans not robots
tammielis
253
25k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
Side Projects
sachag
455
42k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
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