Click here to Skip to main content
15,936,996 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have made one wcf service Method which is consuming third party service methods(call methodA, methodB, methodC) and Here all three belongs to different services i.e. serviceA, serviceB, serviceC..

each method accepting single input object for processing (not List of input object). but i have to work on multiple objects, so i am consuming this methods in for loop..

now the problem is, suppose i have 3 objects to process with methodA, 2 objects to process with methodB and 5 objects to process with methodC.. and consider each method taking 1 sec to process then total time taken to process all is almost 10 seconds.. to overcome this problem after googling i got options like threading and parallel-linq. of course i don't have enough knowledge about threading and its performance, i choose to stay away. Now with parallel linq i found performance is up.. but still expectations are not satisfied(and sometime its throwing timeout exception).. so please advice what should i try now.. whether to dive in threading or anything other to try?
Sergey Alexandrovich Kryukov 8-Aug-15 6:17am    
What tells you that you can considerably improve performance by doing anything in parallel? It won't increase the number of your CPUs or cores responding to a request, can only add threading overhead. Say, you have 5 cores, so that would improve your throughput by some factors when your process 5 objects. But you generally can have many requests for the same service from different users. You need to understand that threading can increase utilization of the CPU by the process using threading, but not the overall throughput of the single computer system.

1 solution

Please see my comment to the question. The most basic thing to understand is: there is no such thing as miracle. With threading, if a number of your CPU cores is less then total average number of, say, requested objects, your throughput won't grow. For further improvement of the throughput, something like a server farm with load balancing is used. Please see:[^],[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900