We created this application, which should have some calculations performed on a remote machine (actually a MatLab server). We use web services to connect to the MatLab server and perform calculations.
To speed up the work, we used Parallel.ForEach()to simultaneously call several services. If we are very conservative when setting ParallelOptions.MaxDegreeOfParallelism(DOP) to 4 or something else, everything works fine and well. However, if we allow the framework to solve DOP, it will spawn so many threads that it will force the remote computer to kneel down and start timeouts (> 10 minutes).
How can we solve this problem? What I LOVE to be able to do is use response time to throttle calls. If the response time is less than 30 seconds, continue to add threads, as soon as it is more than 30 seconds, use less. Any suggestions?
NB In response to the answer in this question: stack overflow
source
share