-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does nodejs handle multiple request? #3151
Comments
I think it will be more helpful if you could share some code that runs with no errors. Also, |
I shared a small modified part of it due to NDA with my company. |
No, because the callbacks are executed sequentially. Here is a demonstration: const http = require('http');
let data = 1;
http.createServer(async(req, res) => {
console.log(data++);
res.end();
}).listen(5000); Here is a bash script to send #!/bin/bash
for i in {1..1000}
do
curl localhost:5000&
done When you run the two, you'll see the server log the numbers |
Thank you |
I read some documentations about how nodejs handle different requests from multiple users at once, but I cannot get my head around it without examples. So I have a question about the next code.
Let's assume a user (A) and another user (B) access this endpoint at the same time. Is there a risk of user B changing the responseBody of user A? If so, when and why? Both requests to token and token-2 will give unique responses to each user.
The text was updated successfully, but these errors were encountered: