3
var http = require('http');
http.createServer(function (req, res) {
    setTimeout(function () {
        res.write("hello");
        res.end();
    }, 10000);
}).listen(8080);

this is my simple node server running on localhost.

Now if i hit this url localhost:8080 from two different browsers simultaneously, i get response at same time on both browsers i.e after around 10 secs.
But on other hand when i do so from two different tabs of chrome browser, it takes 10 secs for one tab and another 10 secs for 2nd tab.

Seems like requests are being processed one after another rather than simultaneously.
can somebody explain?

1

1 Answer 1

1

It's a know browser issue, only happens when you make two requests in the same browser (or browser profile) and separate tabs (XHR requests can actually be done simultaneously).

Sources:

Chrome stalls when making multiple requests to same resource? Multiple instances of PHP script won't load concurrently in the same browser from the same URL

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.