I started noticing that post requests sent to our application server are getting stalled for around 7 seconds on the browser side for no discernible reason.
Environment :
The number of TCP connections, as seen from the Chrome console, are around 3-4 at the time of stalling as seen in Network -> Connection Id
If the user rapidly does around 4 UI operations that create a SSE subscription, followed by the POST, stalling is observed consistently.
I'm not really a UI dev so any help debugging is helpful.
I have seen this too, using Angular 1.4 with Chrome (not sure which version). In our case it seemed to be caused by too many parallel requests. We therefore bundled requests into batches. You can use this function if you like to give it a go and see if it helps in your case:
function _batchRequests(requests, batchSize) {
function doBatch(batches, batchIndex, numBatches, deferred) {
if (batchIndex === numBatches) {
deferred.resolve();
return null;
}
console.log('Doing batch ' + batchIndex);
let p = [];
let batch = batches[batchIndex];
_.forEach(batch, (f) => {
p.push(f());
});
return $q.all(p).then(() => {
doBatch(batches, ++batchIndex, numBatches, deferred);
}, (err) => {
deferred.reject(err);
});
}
let deferred = $q.defer();
let b = batchSize || 3;
let batches = _.chunk(requests, b);
doBatch(batches, 0, batches.length, deferred);
return deferred.promise;
}
Note that the above function depends on lodash for _.chunk and _.forEach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With