I’ve got an action on my website that requires me to check multiple web servers and aggregate the results. Currently this is done synchronously against each web server in a foreach which can be slow depending on how responsive the web-server is.
What Id like to do is each request asynchronously and aggregate all the results when they are all complete.
My question is – with ASP.NET Webforms, what’s the best way to do this? Is there anything I should avoid?
Each request could take 2 seconds so I’d like to kick them all off at the same time.
This sounds like a good care for “standard” asynchronous IO or “standard” threaded IO.
Where
Trepresents{time1, time2, ..}, this would make the responseO(max(T))instead ofO(sum(T))– assuming no sequential dependencies or other bottlenecks.This can be done either using either
Asynchronous IO – where the IO does not block the thread
or Synchronous IO, but threaded – where the IO does block an individual thread
The .NET version used and the API available to get the external data plays a factor in which approach is [more] appropriate.