4 ms·
Node.js internally has a small pool of threads. Processing of response/request is by design handled in one thread designated to handle event loop. Therefore -
by mdomans 10y ago
Node.js internally has a small pool of threads. Processing of response/request is by design handled in one thread designated to handle event loop.
Therefore - if your handler blocks, the _handling_ of requests will be blocked. Your server will still be able to ingest new requests.
The downside of this is that requests are stored internally in a queue so if your handler blocks for a long time, you can bring the whole node down.
Just in case you want a longer read on this:
https://www.toptal.com/nodejs/top-10-common-nodejs-developer-mistakes https://www.toptal.com/nodejs/top-10-common-nodejs-developer...
Or if you want to go really bare internals:
http://www.journaldev.com/7462/node-js-processing-model-single-threaded-model-with-event-loop-architecture http://www.journaldev.com/7462/node-js-processing-model-sing...