Wednesday, 12 February 2014

WCF throttling (Resource Utilization/ Load Balance) configuration

WCF throttling (Resource Utilization/ Load Balance) :
Limit how many instances or sessions are created at the application level for better utilization of resource and memory.

Resource Utilization : With the implementation of throttling, we can properly utilize the available resource like Memory, threads. Each resource could be managed at its reasonable limit to avoid very high utilization of any specific resource.

Load Balance :  Application should work under  balanced load. If we execute anything concurrently then there could lot of performance and load balancing related problem will occur.

WCF throttling allow us to manage our resource utilization and balancing the load as per our processor/RAM availability.
We have  following three property which allow us to control WCF service behavior:
      WCF throttling                  -WCF behavior setting  config level
a.       maxConcurrentCalls  - number of messages that currently process across a ServiceHost (Default: (depends on Framework version) * processor count)
b.      maxConcurrentSessions - number of sessions a ServiceHost object can accept, only the channels below the limit are active   (Default: 16 * processor count)
c.       maxConcurrentInstances - number of InstanceContext objects that execute at one time across a ServiceHost (Default: maxConcurrentSessions +  MaxConcurrentCalls)

·    MaxConcurrentSessions (default: 10)
·    MaxConcurrentCalls (default: 16)
·    MaxConcurrentInstances (default: 26)

Default setting for WCF 4.O for scalability according to the Web Server:
MaxConcurrentSessions: default is 100 * ProcessorCount
MaxConcurrentCalls: default is 16 * ProcessorCount
MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before. (Default: maxConcurrentSessions +  MaxConcurrentCalls)

This setting can be defined at config  file @ service Behaviors level
        <behavior  name="Throttled">

No comments:

Post a Comment