并行与并发 [英] Parallelism vs Concurrency
问题描述
寻找更好的方法和概念背后的Task.Run与Parallel.Foreach。
Looking for better approach and concept behind Task.Run Vs Parallel.Foreach.
试图解决的问题:调用Web服务,需要20秒才能回复并在C#desktop中以10万次的循环运行它。
Problem trying to solve: Call web service and it takes 20 seconds to respond back and run this in a loop for range of 100,000 times in C# desktop
我正在考虑使用数据并行性,并且花费大约15分钟来完成6次并行操作。如果我必须使用Task.Run(因为它是I / O),试图找出是否会返回线程并在
中同时启动另一个请求?如何找出在此过程中使用了多少线程
I am thinking to use data parallelism and it took probably 15 minutes to complete the operation with 6 degree of parallelism. If I have to use Task.Run (since it is I/O), trying to find out whether thread will be returned and start another request in the same time? How to find out how many threads are utilized in this process
谢谢,
Muthu
推荐答案
问题试图解决:调用Web服务,需要20秒才能回复并在C#desktop中循环运行10万次
所以你说的是你正在拨打服务100,000次?如果这是真的,那么出于什么目的?
So you are saying that you are calling a service 100,000 times? If that is true, then for what purpose?
这篇关于并行与并发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!