Poll Vs AsyncCallback callbacks - the best approach for a slow web service?

I have a webpage that uses AJAX to get search results for a page. On the server side, I request a web service that is very slow - from 20 seconds to 2 minutes.

As far as I understand, my parameters are a survey or a lengthy request.

AsyncCallback seems ideal as the result will be returned as soon as the web service responds and the thread is not blocked on the server side.

Is there a better way to do this? Do you know any problems with long HTTP requests in jQuery?

Update: Yes, I will cache the response from the web service whenever possible. I cannot control the external web service that I request.

+7
jquery asynchronous web-services
source share
2 answers

We use AsyncCallbacks to poll the server, which typically responds between 4:30 and 5 minutes, and the system works fine.

It should be noted that you will not get any benefits (performance, response time, etc.), except that the IIS workflow thread pool will not be exhausted if you receive too many requests: i.e. If we get 2 requests per minute, we will usually have 10-12 pending requests. In this case, AsyncCallback will not make any difference. If we get 100 requests per minute, this means 500-600 pending connections, so Async is a must. This applies only to thread pool management.

+2
source share

There is only one problem with this approach to viewing users on another page, what you can do is cache the results somewhere so that you do not access the web service all the time.

+1
source share

All Articles