Throttling in WCF (Part-27)

Throttling controls how many messages are processed.

What is Throughput?
Throughput is the amount of workdone in a given time.In addition to Service InstanceContextMode and Concurrency mode, Throttling settings also influence the Throughput of a WCF service.

Throttling settings can be specified either in code or in config file.

In app.config file:

In code:

With a PerCall instance context mode, only 2 calls are processed concurrently.This is because every call requires a new service instance and here we are allowing only a maximum of 2 concurrent instances to be created.

With a single instance context mode,3 calls are processed concurrently because with a Singleton service there is only one service instance which handles all the requests from all the clients.with Singleton,maxConcurrentInstances property does not have any influence.

maxConcurrentInstances is the sum of all types of sessions.

  • Application Sessions
  • Transport Sessions
  • Reliable Sessions
  • Secure Sessions

Throttling Default values:
Before WCF4.0:
maxConcurrentCalls =16
maxConcurrentSessions=maxConcurrentCalls + maxConcurrentInstances(26)
WCF 4.0 and later:
maxConcurrentCalls =16 * processor count
maxConcurrentInstances=100 * processor count
maxConcurrentSessions=maxConcurrentCalls + maxConcurrentInstances

© 2015, www.techkatak.com. All rights reserved.