3 ms·
What does happen with the 5th request.
by x86_64Ubuntu 7y ago
What does happen with the 5th request.
- kevstev 7y agoIt will get queued, until one of the 4 requests in front of it has its task, to return the file, complete.
- jwalton 7y agoWell... yes. If you're using `express.static()`, or if all five requests are getting different things from the disk. If you're using something that caches your static content in-memory, then the first request will use the thread pool to read that content, but the other four requests won't touch the thread pool - it's all async IO at that point, so it's all happening "concurrently" in a single thread, being multiplexed right here: https://github.com/libuv/libuv/blob/1ce6393a5780538ad8601cae00c5bd079b9415a9/src/unix/posix-poll.c#L188 https://github.com/libuv/libuv/blob/1ce6393a5780538ad8601cae...
- NathanKP 7y agoIt waits in a queue in a background thread in the node.js http library until your code can execute to handle it. So if your code takes a long time before returning back to the event loop the request will just wait in that queue for a long time before the next opportunity for the event loop to execute code in response to the event.