I'm in the process of creating a Web Application that involves making multiple simultaneous XHR calls using Ajax instead of native Javascript.
$.ajax({
type: 'POST',
url: 'Services/Service.asmx/MyFunction',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({
'something': 'Something'
}),
success: function (data) {
// Perform actions with the received data.
},
error: function (xhr, status, error) {
// Handle any errors that occur.
}
});
During debugging of the application and testing of two or more simultaneous calls, I noticed that although the client initiates XHR calls immediately after page load, there is a delay when multiple requests are made to the same web method fetching identical responses. This delay increases with each subsequent call.
https://i.sstatic.net/uCOni.png
It appears that the server processes these XHR calls sequentially rather than in parallel - receiving the requests, handling one at a time, responding, before moving on to the next request. Is this intentional behavior, or is there a way to have the server handle each request independently and concurrently?