iCode
iCode

Reputation: 4338

maximum value for DefaultConnectionLimit

What is the maximum suggested value for ServicePointManagaer.DefaultConnectionLimita on a 4 core machine connected to Comcast 12Mbs connection? I hope the answer is more than saying that it depends! :) Is there any practical limit? This http://support.microsoft.com/kb/821268 says 12*number of cores but was wondering if there is any complication in setting this to much higher number? Is there any point doing so?

Upvotes: 2

Views: 710

Answers (2)

Davide Icardi
Davide Icardi

Reputation: 12209

In my experience if the value is too high there is a performance degradation. Unfortunately there are too many variables, for this reason there isn't a value/formula that can be used in all cases. Here some of those variables:

  • bandwidth
  • processor
  • type of request (size, compression, keep-alive,...)
  • endpoint (some servers doesn't allow any numbers of connections from the same host)

My suggestion is to test your application with different settings and see the result. I have found useful to set the max connections for each endpoint, so you don't have a single configuration but one configuration for each endpoint.

Upvotes: 0

Sam Rueby
Sam Rueby

Reputation: 6129

The best value for the DefaultConnectionLimit property depends on the application workload and proxy settings. A general recommendation when only connecting to a few hosts or connecting through a proxy is to use a value that is 12 times the number of CPUs on the local computer. So for a computer with 4 CPUs using a proxy, the recommended value would be 48.

Source: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

The 12-times-limit is for when using a proxy. I think it truly depends on how you're using the connection. 100 connections to query a web service that involves a ~4Kb response is much different than 100 connections downloading gigabytes of data. So depending on how you're using the connections, I would use your best judgement and set it to something reasonable.

Upvotes: 3

Related Questions