[WCF]Things that will impact concurrency & capacity behavior of WCF service (with simoultaneous client requests/connections)
I have found that many guys have encountered some concurrent connection limit problems when calling WCF service in their .NET application. Here are some information that may help resolve such kind of problems:
1. Operating system inbound connection limitation
Windows client operating system such as XP and Vista has inbound connection limitation. Threrefore, if your network based service is hosted on such kind of operating system, you do need to take care of such limitation.
#Inbound connections limit in Windows XP
2. .NET application max outbound connection limitation(per appdomain)
For .NET framework based application, there is a per-appdomain outbound connection limitation(default 2 for each remote server). We can adjust it via the “system.net/connectionManagement” configuration section.
#<connectionManagement> Element (Network Settings)
Also, for ASP.NET 2.0 application, there is something else we need to take care:
#Contention, poor performance, and deadlocks when you make Web service requests from ASP.NET applications
#MaxConnection does not have effect on ASP.NET 2.0
3. WCF specific concurrent connection limitation
After we’ve eliminated all the OS and .NET standard network issues, there comes to the WCF specific settings that restrict concurrent WCF client requests.
WCF provide some service level settings that can restrict the concurrent connection behavior from WCF clients. Also, such settings also somewhat rely on the Instance and session mode the service is using. The following config fragment has demonstrated the three attributes that mainly affect the service throttling behavior:
<behavior name=”[service behavior name]”>
And here is the description from MSDN document:
A positive integer that limits the number of messages that currently process across a ServiceHost. Calls in excess of the limit are queued. Setting this value to 0 is equivalent to setting it to Int32.MaxValue. The default is 16.
A positive integer that limits the number of InstanceContext objects that execute at one time across a ServiceHost. Requests to create additional instances are queued and complete when a slot below the limit becomes available. The default is Int32.MaxValue.
A positive integer that limits the number of sessions a ServiceHost object can accept.
The service will accept connections in excess of the limit, but only the channels below the limit are active (messages are read from the channel). Setting this value to 0 is equivalent to setting it to Int32.MaxValue. The default is 10.
Also, if you want to get more on these settings, here is a blog entry which provide more explanation:
#Throttling in WCF