Optimize HTTP requests and web service calls

by Mads Kristensen 30. May 2007 05:11

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.

* Only $4.95/month ASP.NET & Windows 2008 + IIS 7 Hosting! FREE SQL Included

Tags:

ASP.NET

Comments

5/30/2007 6:04:30 AM #

trackback

Trackback from DotNetKicks.com

Optimize HTTP requests and web service calls

DotNetKicks.com |

5/30/2007 10:23:19 AM #

trackback

Trackback from Steven Smith

Optimize ASP.NET HTTP Connection Limit

Steven Smith |

5/31/2007 11:50:18 PM #

NinjaCross

Nice shoot.
This is often an under-looked argument, and it's so strange if you consider that it's one of the most important.
Anyway, it's so hilarious the first section of the MSDN article you linked... it starts with "The Scenario: Performance Devastation ..." Laughing

NinjaCross Italy |

6/1/2007 2:33:58 AM #

trackback

Trackback from DotNetKicks.com

Optimize HTTP requests and web service calls

DotNetKicks.com |

6/1/2007 4:49:38 PM #

pingback

Pingback from blogzaa.com

BlogZaa  » Blog Archive   » ASP.NET, ASP.NET AJAX, Visual Studio and .NET

blogzaa.com |

6/7/2007 5:24:36 AM #

Zvika Rap

Sorry, but this was only true for ASP.NET 1.1 ...
In ASP.NET 2.0, however, you no longer need to configure maxConnection manually as it is now automatically scaled and set.

More details: www.microsoft.com/.../

Zvika Rap Israel |

6/14/2007 9:16:18 PM #

trackback

Trackback from Blocks4.NET Team Blog

Optimize HTTP Requests

Blocks4.NET Team Blog |

5/22/2009 3:52:09 AM #

pingback

Pingback from mundeep.wordpress.com

HTTP 2 Connection Limit « Point Deep

mundeep.wordpress.com |

Comments are closed

About the slave

Mads Kristensen Mads Kristensen
Web developer at ZYB and founder of BlogEngine.NET. More...

LinkedIn ZYB Facebook Last.fm Twitter View Mads Kristensen's profile on Technorati

The Lounge

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008