# When is NodeJS Single Threaded and when is it multi-Threaded?

> Episode of [The Backend Engineering Show with Hussein Nasser](https://podistic.com/podcast/the-backend-engineering-show-with-hussein-nasser.md) · Published March 24, 2021 · Duration 9:06

- **Listen on Podistic:** https://podistic.com/episode/when-is-nodejs-single-threaded-and-when-is-it-multi-threaded
- **Audio:** https://traffic.megaphone.fm/APO6758904026.mp3 (audio/mpeg)

## About this episode

Node JS Is single-threaded asynchronous non-blocking javascript runtime, but it's 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 Loop single thread, that really just loops for callbacks 0:00
*   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)

  

Support my work on PayPal

[https://bit.ly/33ENps4](https://bit.ly/33ENps4)

Become a Member on YouTube

[https://www.youtube.com/channel/UC\_ML5xP23TOWKUcc-oAE\_Eg/join](https://www.youtube.com/channel/UC_ML5xP23TOWKUcc-oAE_Eg/join)

[🧑‍🏫](https://emojipedia.org/teacher/) Courses I Teach

https://husseinnasser.com/courses
