28. September 2007 05:15
Never rely on the default values for your service configuration. This is something that seems to bite a lot of developers that are new to WCF. The large majority of the settings default to predetermined values intended to help create a more secure "out of the box" service. However, many of these settings are not very conducive for scalability and performance.
Let's look at a few settings with default values that can be problematic.
MaxConcurrentCalls is used to define a limit on the number of messages that can be processed by a service at any given time. Another way of looking at it is the number of threads that will be available for serving requests. The default value for MaxConcurrentCalls is 16. Once there are 16 concurrent calls, the requests will start getting queued. Depending upon the throughput required for your scenario, the default value may not be sufficient.
MaxConcurrentSessions has a similar problem. This setting places an upper bound on the number of sessions permitted by your service at any given time. The default value is 10, which means only 10 sessionful clients would be allowed to simultaneously connect to the service.
MaxReceiveMessageSize of the WsHttpBinding specifies the maximum number of bytes allowed for a message. The default value is a measly 65.536 bytes. If you move very far beyond a "Hello World" WCF service, you are going to need more than 65,536 bytes for a message. This is especially true for security configurations that have require sizable SOAP header in addition to the actual payload of the message body.
These are just a few of the settings that you should review more closely. Never make the assumption that WCF will auto-magically apply the configuration values that work best for your service and environment. You should always conduct proper testing of your configuration. Most likely, it will require a bit of tweaking to get the values just right for your particular scenario. Failure to do so can (and often will) result in poor performance and/or scalability.
Don't get caught falsely accusing WCF of poor performance simply because you didn't properly configure the service!
20ca915f-9a88-43c7-a6e6-a123d21a7ce5|0|.0
By: Jeff Barnes
Category:
Tags: