When is NodeJS Single-Threaded and when is it Multi-Threaded?

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…

When is NodeJS Single-Threaded and when is it Multi-Threaded?

Source

0
(0)

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/dont-block-the-event-loop/

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
https://www.youtube.com/playlist?list=PLQnljOFTspQXjD0HOzN7P2tgzu7scWpl2

🏰 Load Balancing and Proxies Videos
https://www.youtube.com/playlist?list=PLQnljOFTspQVMeBmWI2AhxULWEeo7AaMC

🏛️ Software Archtiecture Videos
https://www.youtube.com/playlist?list=PLQnljOFTspQXNP6mQchJVP3S-3oKGEuw9

📩 Messaging Systems
https://www.youtube.com/playlist?list=PLQnljOFTspQVcumYRWE2w9kVxxIXy_AMo

Become a Member
https://www.youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join

Support me on PayPal
https://bit.ly/33ENps4

Stay Awesome,
Hussein

0 / 5. 0