WebServicesPro
MarketingNewz
SmallBusinessNewz












Optimize HTTP Requests & Web Service Calls

By Mads Kristensen
Expert Author
Article Date: 2007-06-06

ASP.NET has an outgoing connection limit which is set to 2 connections by default.

It means that the ASP.NET process does not create more than 2 concurrent connections simultaneously, but instead queues them up.

Consider the scenario where you call 4 web services asynchronously from the same method.

What happens is that the first two starts to execute, while the next two waits for the first two to finish.

The same thing happens for HttpRequests.

That is a waste of time in most cases, so you can raise the connection limit to allow more simultaneous reqests in the web.config.

<system.net>

  <connectionManagement>

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

  </connectionManagement>

</system.net>


Every asynchronous request is started in its own thread, so you have to be careful not to raise the limit too far.

The more CPU's or cores the web server have, the higher can you set the connection limit.

You can read more about asynchronous requests and the connection limit on MSDN.

Comments

About the Author:
Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/




WebServicesPro is an iEntry, Inc. ® publication - 1998-2008 All Rights Reserved Privacy Policy and Legal