Hi
I have a problem with one AJAX call blocking another. I suspect that I don't really fully understand what's going on "under the hood/bonnet" to know if I can fix this behaviour so would appreciate a full explanation if one exists, or better still a way to fix the behaviour.
Scenario
I have a page that displays a list of products. Most of the information for these products is quick to get from the database, but stock data requires calls to 3rd party systems.
The solution is to load the page quickly with the majority of the data. As soon as the page has loaded, an AJAX call is automatically fired to retrieve stock information that takes between 5-10 seconds.
Meanwhile, the Shopper can click on a button that also does an AJAX call back - the call is very quick and the results are displayed in a Tooltip (think that fact is probably irrelevant).
The initial problem was that when the Shopper clicked on the button, it cancelled the call to get stock. I got around that problem by setting the RequestQueueSize property to be a number greater than 0.
Problem
If the Shopper spends 10 seconds reading the page and then clicks on the button, they see their results load almost instantaneously - this is because the Stock data has been returned. However, if the shopper clicks on the button as soon as they page has loaded, then they will have to wait until the long-running call to get the stock information has completed.
My understanding ...
I thought that the whole point of being asynchronous was that once the JavaScript engine had sent the Request off to the server, it would then be free to handle other jobs in the queue. Once the Response was received from the Server, it would then be added to the queue.
This being the case, it should work as follows:
However, it appears that the second Request is not sent until the first Response has been received.
I thought that a "standard" browser could have a maximum of two connections to a single domain (HTTP Limits) so if nothing else is occuring on my page then this should work as expected.
So is Telerik RadAjaxPanel managing a single queue and only firing off a Request if the previous Request has already been returned?
If so, then from the link regarding HTTP connection limits, there really ought to be two queues per domain.
Think I need that explanation....
Many thanks in advance!
Griff
I have a problem with one AJAX call blocking another. I suspect that I don't really fully understand what's going on "under the hood/bonnet" to know if I can fix this behaviour so would appreciate a full explanation if one exists, or better still a way to fix the behaviour.
Scenario
I have a page that displays a list of products. Most of the information for these products is quick to get from the database, but stock data requires calls to 3rd party systems.
The solution is to load the page quickly with the majority of the data. As soon as the page has loaded, an AJAX call is automatically fired to retrieve stock information that takes between 5-10 seconds.
Meanwhile, the Shopper can click on a button that also does an AJAX call back - the call is very quick and the results are displayed in a Tooltip (think that fact is probably irrelevant).
The initial problem was that when the Shopper clicked on the button, it cancelled the call to get stock. I got around that problem by setting the RequestQueueSize property to be a number greater than 0.
Problem
If the Shopper spends 10 seconds reading the page and then clicks on the button, they see their results load almost instantaneously - this is because the Stock data has been returned. However, if the shopper clicks on the button as soon as they page has loaded, then they will have to wait until the long-running call to get the stock information has completed.
My understanding ...
I thought that the whole point of being asynchronous was that once the JavaScript engine had sent the Request off to the server, it would then be free to handle other jobs in the queue. Once the Response was received from the Server, it would then be added to the queue.
This being the case, it should work as follows:
- Request for stock sent
- Request for button-click sent
- Response for button-click received (and processed)
- Response for stock received (and processed)
However, it appears that the second Request is not sent until the first Response has been received.
I thought that a "standard" browser could have a maximum of two connections to a single domain (HTTP Limits) so if nothing else is occuring on my page then this should work as expected.
So is Telerik RadAjaxPanel managing a single queue and only firing off a Request if the previous Request has already been returned?
If so, then from the link regarding HTTP connection limits, there really ought to be two queues per domain.
Think I need that explanation....
Many thanks in advance!
Griff