Async WebService Calls and the 2 Call Limit

Link. July 19, 2006. Comments [1]. Posted in: .NET | Web Services
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...



Thursday, July 20, 2006 10:47:55 AM (SA Pacific Standard Time, UTC-05:00)
Great point - I was wondering if this was a "playing nice" feature. I'm on vacation this week, but I'll check out the results and post them later today.

Thank you,
-Steve
Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1050
This Year: 1
This Month: 1
This Week: 0
Comments: 825

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.2.8279.16125

Sign In