DEV Community

Discussion on: How can Nodejs handle many requests ?

Collapse
 
solarliner profile image
🇨🇵️ Nathan Graule

Node.js doesn't have 4 threads, as JavaScript is single-threaded. Node.js' "asynchronous"-ness is a well decorated lie because while you can use async/await in the code, you're only doing that to free the single thread Node.js has to do other things it has planned.

In short, every "async" call, or calls through setTimeout or setImmediate adds the function to a stack of different functions to call. Node.js then go through them in order.

The only right answer to "how to make Node.js fast" is to have several Node.js processes running the same code, and have a way to distribute requests to them.