Fun with performance testing


I was troubleshooting some performance issues today when I found out about this property:

ServicePoint.ConnectionLimit

I am currently working on a multi-threaded windows application that uses HttpWebRequest to communicate with external web resources. By default, .NET sets this connection limit to 2. Which means there are only 2 threads available for connecting to an external web resource. As a result, when I throttled my app with more than 2 threads, this setting became a performance bottle neck.

To solve the problem, I just had to raise this limit. The optimal setting of this property depends on the processing power of your app server and the load the web resource can handle. To set this property in code, just access the ServicePoint property on the instance of the HttpWebRequest object.

Alternatively, you can also configure this value in your app.config file with the xml below.

<system.net>
    <connectionManagement>
            <add address = "*" maxconnection="20" />
        </connectionManagement>
</system.net>
«January»
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567