I know this is probably a very simple question to most of you. If you could answer that would be great. I have a node.js app on heroku and after someone sends a post request to my app I process it which can take anywhere from 5s to several minutes depending on the size of the file sent to my app. If two people send a post request does the second person wait in line and gets his request filled only when the first person is done? Or does he get his own node app and is processed independently?
Asked
Active
Viewed 128 times
1
-
1Look to this for a great explanation https://stackoverflow.com/questions/34855352/how-in-general-does-node-js-handle-10-000-concurrent-requests – Chuck LaPress Aug 09 '18 at 01:10
-
See also: https://stackoverflow.com/a/19324665/362536 – Brad Aug 09 '18 at 01:10
-
Also relevant: [Request priority in Express](https://stackoverflow.com/questions/35321932/how-we-he-handle-requests-priority-in-express-nodejs/35322333#35322333) and [Can two http requests come together and how does nodejs handle it?](https://stackoverflow.com/questions/40571109/can-two-http-request-come-together-if-it-can-how-nodejs-server-handles-it/40571246#40571246) and [Does nodejs handler client requests one by one?](https://stackoverflow.com/questions/32062990/does-node-js-handle-client-requests-one-by-one/32063754#32063754) – jfriend00 Aug 09 '18 at 01:20
1 Answers
0
This depends entirely on how your app is structured.
Generally, no, one user isn't going to have to wait on the other. While it's true that your application code in Node.js is single threaded, it isn't just blocked all the time. The idea is that the single thread will go around in circles, servicing all the clients with small pieces of work.
Now, in a poorly designed application, this can be an issue. If you block the thread and do something CPU-intensive, your app won't be able to go around.

Brad
- 159,648
- 54
- 349
- 530