Executing web-service calls in parallel

后端 未结 2 1513
猫巷女王i
猫巷女王i 2021-01-24 08:56

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

相关标签:
2条回答
  • 2021-01-24 09:46

    Web requests are not suitable for TPL, since they are IO, not processing. You already had all the necessary infrastructure in place since .Net 2.0: BeginGetResponse and BeginGetResponseStream. Keep a lid on the number of outstanding requests (~200 is a good consumer OS, ~2000 is for server flavours, after accordingly tweaking the TCP parameters, specially TcpNumConnections) and make sure you adjust the ServicePointManager.DefaultConnectionLimit.

    Trying to achieve high scale and high bandwidth/throughput by simply throwing synchronous IO calls on tens and hundreds of tasks via TPL will get you nowhere fast.

    0 讨论(0)
  • 2021-01-24 09:47

    You might find this discussion relevant:Async instead of Parallel

    0 讨论(0)
提交回复
热议问题