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
860
Saving the world, one line at a time [CodeLeaders Australia 2019]
jawache
0
62
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
20
How to hack an Angular app? - ngConf 2018
jawache
0
770
How to hack an Angular app? @ ngVikings 2018
jawache
1
1k
How to hack a python app? @ PyCaribbean 2018
jawache
0
160
Other Decks in Programming
See All in Programming
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
890
Goのエラースタックトレースの歴史と今後
sonatard
7
1.1k
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
200
Java 22 Overview
kishida
1
180
ONE WEDGE_company_guide
1wedge_one
0
450
Netty Chicago Java User Group 2024-04-17
sullis
0
170
HUIT新歓2024「競技プログラミング、やってみませんか?」
slephy2784
1
270
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
180
Hanami and htmx
bkuhlmann
0
200
Ruby GitHub Packages
bkuhlmann
0
630
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
410
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
340
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
68
8.6k
Design by the Numbers
sachag
274
18k
The Pragmatic Product Professional
lauravandoore
25
5.8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
125
32k
Mobile First: as difficult as doing things right
swwweet
216
8.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
9
8.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
14
1.5k
Building Your Own Lightsaber
phodgson
99
5.7k
Agile that works and the tools we love
rasmusluckow
325
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
243
12k
Statistics for Hackers
jakevdp
789
220k
The Cult of Friendly URLs
andyhume
74
5.7k
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