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 am querying a web service that is very slow - 20 seconds to 2 minutes.
As I understand it, my options are either polling or having a long running request.
AsyncCallback seems to be ideal since the result would be returned as soon as the web service responds and the thread won't be blocked on the server-side.
Is there a better approach to doing this? Do you know of any issues with long running HTTP requests in jQuery?
Update: Yes, I will be caching the response from the web service when possible. I don't have any control over the external web service that I am querying.
We are using AsyncCallbacks for a server polling that tipically respons in 4:30 - 5 minutes, and the system runs just fine.
It is worth mentioning that you will get no benefits (performance, response time,etc) except the fact that IIS's worker thread pool will not get depleted if you get too many requests: ie. If we get 2 requests per minute, we will usually have 10 - 12 pending requests.In this case AsyncCallback will make NO difference whatsoever. If we get 100 requests per minute, this means 500 - 600 pending connections, so Async is a must. It's only about managing the thread pool.
用户浏览到另一个页面的方法只有一个问题,你可以做的就是将结果缓存在某处,这样你就不会一直查询web服务。
链接地址: http://www.djcxy.com/p/2074.html上一篇: pdb文件实际上做了什么?
下一篇: 缓慢的Web服务最好的方法?