Reputation: 1007
In regards to concurrent ajax requests, i have looked at this page:
How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?
But what if onload i have js script creating many http objects with the code:
// JavaScript Document
//declare xmlhttp object
var xmlhttp = false;
var xmlhttp2 = false;
//determine browser/connection type
if (window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
xmlhttp2 = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
}
I have about 6 different js scripts which are all tailored to perform slightly different ajax functions.
My question is if i have 6-10 different xmlhttp objects being created on pageload, will it somehow be an issue?
Furthermore, even if i have 20 different tailored ajax scripts, aside from what i mentioned above, as long as i dont have more than 3 running at the same time they can all exist toegther, as long as they use different global variables, correct?
Upvotes: 1
Views: 212
Reputation: 109252
The number of such objects you can create is only limited by the available memory, i.e. for all practical purposes it is unlimited. As mentioned in the question you reference, the ones that aren't being served immediately are queued up. In practice that means that your application might need a long time to load.
I would try to keep the number of concurrent connections as low as possible (<5). More connections will make the user experience worse. If you have a very large number of connections, the server might block you as well.
Upvotes: 1