multithreading - Consuming a web service in multiple threads c# -
i consuming web service provided me vendor in c# application. application calls web method in loop , slows down performance. complete set of results, takes more hour.
can apply multi threading on side consume web service in multiple threads , combine results together?
is there better approach retrieve data in minutes instead of hours?
first of have make sure vendor does indeed support this or not prohibit (which probable too).
the code straightforward, using method such parallel.for
simple example (google.com):
parallel.for(0, norequests, => { //code request goes here } );
exaplanation:
in parallel.for
loop, requests executed in-parallel (as implied in name), potentially provide significant increase in performance.
further reading:
Comments
Post a Comment