Reputation: 189
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?
Upvotes: 3
Views: 63
Reputation: 5817
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
Upvotes: 1