Implementing a WCF Service with High Performance

Hi Folks,

WCF gives the developer the tools to provide high performance for your WCF Service,once of the key features to provide high performance WCF Service caled “Service Throttling”;this concept simply provide you the values you want to set to manage the following:

1) Maximum Concurrent sessions.
2) Maximum Concurrent Calls.
3) Maximum Concurrent Instances.

These values should be set on the host app of the service,and the admin has to monitor the server which host WCF Services to monitor the perfomance of the running WCF services.

To Implement Service throttling on your service,you have to write this code before open the serviceHost Object :

// Required for the ServiceThrottlingBehavior class
using System.ServiceModel.Description;

ServiceHost host = new ServiceHost(…);
ServiceThrottlingBehavior throttleBehavior = new ServiceThrottlingBehavior();
throttleBehavior.MaxConcurrentCalls = 40;
throttleBehavior.MaxConcurrentInstances = 20;
throttleBehavior.MaxConcurrentSessions = 20;
host.Description.Behaviors.Add(throttleBehavior);
host.Open();


Note : that we set these values before open the servicehost object.

Take care of the following Tips :
1) Default Concurrent Instances is Int32.Max = 21474836467
2) Default Concurrent Calls is 16
3) Default Concurrent Calls is 10


Hope this helps for WCF developers :)




Regards,
Moustafa arafa

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>