Portal Home > Knowledgebase > Articles Database > AJAX request waiting on other concurrent requests


AJAX request waiting on other concurrent requests




Posted by ScottAN, 07-30-2008, 04:02 PM
I have a server monitoring system that is fully AJAX. There is one xmlhttprequest object created when the page loads and it is used to check for new server status updates. The currently displayed information is POSTed to the script and it checks to see if there are any new updates. If not, the script will sleep for 20 seconds and try again, if there are new updates it will return the new alerts. The problem is whenever this AJAX request is still loading any other xmlhttprequests will wait until the other status checking thread returns a value. Any idea why this is happening? For all other requests a new xmlhttprequest object is created so none are reused. Thanks in advance for the help! Last edited by ScottAN; 07-30-2008 at 04:07 PM.

Posted by Saeven, 07-31-2008, 11:52 AM
The XHOR object is browser-specific, so different browsers have different implementations of it and its limits. Some libraries provide you with a task handler that will transparently manage XHOR calls for you. For example, ExtJS has a TaskRunner that will run tasks in the background, giving priority to your "manual" XHOR requests otherwise. See: http://extjs.com/deploy/dev/docs/?cl...til.TaskRunner Firefox 2 and IE 7 for example, only allow 2 calls at any given time. I think I read somewhere that FF3 boosts this to 8 (can anyone substantiate the claim?). Cheers. A

Posted by ScottAN, 07-31-2008, 04:39 PM
That is the JS that handles the refreshing. I changed it up so that a new xmlhttp object is created (thats what getXMLHttpObject() does) each time the status is checked. On the server side the script will check to see if the current status matches what is displayed and if they match it will sleep() for 25 seconds and try again until the node status is different (then it returns the new status info and dies). I have seen this same sort of thing implemented on other sites (mainly Facebook). For each page Facebook opens an xmlhttp request that is open but stays pending for a while. Other requests go through fine and do not wait for the pending request. I'm using FireBug to monitor this by the way so I can see what's going on.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
vpseasy.com. down (Views: 672)
fdc down (Views: 631)
Liquidweb dead? (Views: 787)

Language: