Steve Hebert comments here on his experience doing async calls to Web Services and seeing what seems like a limitation in the way the BeginXXX() methods work:

"Furthermore, when you watch this run in NUnit you’ll see that it’s actually making two requests at a time (two results appear simultaneously, two second wait, two more results appear simultaneously, two second wait…, and so on)."

Steve attributes this behavior to a limitation (design flaw?) in the way .NET is doing the async calls and the way it uses the threadpool for that. However, seeing the "2 concurrent requests" magical number, I wonder if this might be impacted by something else entirely: The 2-connections-to-a-single-server limit imposed by the HttpWebRequest class to comply with the recommendations in the HTTP spec. 


I've had several encounters with this limitation where it can severely limit your concurrency if you're doing a lot of webservice calls to the same service (or to services hosted on the same server, more precisely). Fortunately, it's easy to work around by modifying your configuration file:


   <system.net>


      <connectionManagement>


         <add address="*" maxconnection="15"/>


      connectionManagement>


   system.net>


Tess has a pretty extensive description of debugging and fixing the kind of problems this limitation can cause on live systems. I wonder if changing this would change the results of Steve's test...




Tomas Restrepo

Software developer located in Colombia.