Geeks With Blogs
HanSolo code monkey

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>
Posted on Friday, January 23, 2009 12:20 AM | Back to top


Comments on this post: Fun with performance testing

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © HanSolo | Powered by: GeeksWithBlogs.net