When is NodeJS Single-Threaded and when is it Multi-Threaded?
Автор: Hussein Nasser
Загружено: 2021-03-23
Просмотров: 77841
Node JS Is single threaded asynchronous non-blocking javascript runtime, but its not always single threaded there are occasions where nodejs uses multi-threading, so the questions we will try to answer in this video, when is nodejs single threaded and when does it use multi-threading and how will that affect my app?
Event main Loop 0:00 single thread, that really just loops for callbacks
Threading in Node jS (libuv) 4:00
used for
IO/intensive
DNS queries
file system reads
CPU intensive
crypto
compression
process.env.UV_THREADPOOL_SIZE=1
Examples 8:00
Cluster Nodejs 16:00
Example 1
Http server return 1
Http server while 1
Http server with file system read async
Http server with file system read sync
Http server with fetch call to server (dns)
Resources
https://nodejs.org/en/docs/guides/don...
http://docs.libuv.org/en/v1.x/index.html
🎙️Listen to the Backend Engineering Podcast
https://husseinnasser.com/podcast
🏭 Backend Engineering Videos
https://backend.husseinnasser.com
💾 Database Engineering Videos
• Database Engineering
🏰 Load Balancing and Proxies Videos
• Proxies
🏛️ Software Archtiecture Videos
• Software Architecture
📩 Messaging Systems
• Message Queues & PubSub Systems
Become a Member
/ @hnasr
Support me on PayPal
https://bit.ly/33ENps4
Stay Awesome,
Hussein
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: