Hacker News new | past | comments | ask | show | jobs | submit login

What does happen with the 5th request.



It 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.


It will get queued, until one of the 4 requests in front of it has its task, to return the file, complete.


Well... 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/1ce6393a5780538ad8601cae...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: