并行执行的Web服务调用 [英] Executing web-service calls in parallel
问题描述
我看到这些问题的<一个href="http://stackoverflow.com/questions/1976073/recommendations-for-executing-net-httpwebrequests-in-parallel-in-asp-net">Recommendations在ASP.NET 和<一个执行.NET HttpWebRequests并行href="http://stackoverflow.com/questions/2477931/async-parallel-or-array-parallel-map">Async.Parallel或Array.Parallel.Map 从大约一年前,想知道是否从他们的建议仍然有效,或者如果有现在的任务并行库。
I saw these questions Recommendations for executing .NET HttpWebRequests in parallel in ASP.NET and Async.Parallel or Array.Parallel.Map from about a year ago and was wondering if the advice from them still stands or if there's now a better approach with Task Parallel Library.
我的情况更接近第二个问题,但我只需要打,而不是同一台3000倍10(ISH)不同的网络服务。由于这是一个Web应用程序,并那种要求放大更改建议的方法呢?有没有更好的方式来走?我怎么也能期待这样的规模随着用户数量的增加?
My case is closer to the second question, except I only need to hit 10(ish) different web-services instead of the same one 3000 times. As this is a web application, does that kind of request amplification change the suggested approach? Is there a better approach to take? How well can I expect something like this to scale as the number of users increases?
的几个注意事项:
- 在缓存的结果将是下一个实现细节,但我想获得的基本功能工作的第一个
- 在每个Web服务的回报非常少的数据(下KB),最长的一次时间不超过3秒钟返回,我相信大多就是延迟(产生的结果不计算成本)
- 从客户端调用网络服务将无法正常工作(我不认为),因为有些是在不同的域
- 无论是C#F#实现将工作作为理想,这将抽象出来一个方法调用,需要一个
字符串
并返回的集合字符串
取值
- Caching results will be the next implementation detail, but I would like to get the base functionality working first
- Each web-service returns very little data (under a kb), longest one takes no more than 3 seconds to return and I believe most of that is latency (generating results not computationally expensive)
- Calling web-services from the client won't work (I don't think) as some are in different domains
- Either C# of F# implementation would work as ideally this will be abstracted away to a method call that takes a
string
and returns a collection ofstring
s
推荐答案
您可以找到相关的讨论:<一href="http://stackoverflow.com/questions/4310997/how-to-achieve-asynchrony-instead-of-parallelism-in-f">Async而不是并行
You might find this discussion relevant:Async instead of Parallel
这篇关于并行执行的Web服务调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!