Click here to Skip to main content
12,350,451 members (24,122 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

27.8K views
6 bookmarked
Posted

WCF Service Throttling

, 3 Jul 2010 Ms-PL
Rate this:
Please Sign up or sign in to vote.
The following summarizes the throttling behavior elements and their default value setting.

Throttling is an important behavior of your WCF service that you should be addressing before publishing your service to clients.

The throttling behavior holds the configuration for 3 limitations that control the amount of resources that your service hosting can allocate to deal with client requests, thus enables you to manage the resource usage and balance the performance load.

It is crucial that you set the behavior appropriately because the default limitations of this service behavior is considered to be quite low.
The reason for such default values was for blocking DOS (Denial of Service) attacks on your service. However, most of the services we build are on-premises services within our enterprise, it is more appropriate to support more clients rather than block malicious attacks of some kind. (The general purpose is to find the right balance between the two, yet, it usually isn't as the default values are.)

Why am I blogging about it just now?
Well, one of the rather unknown changes made in WCF 4.0 is the change of the service throttling behavior default values.

Microsoft realized that the prior default values weren't practical and were seldom applied that way.

The following summarizes the throttling behavior elements and their default value setting.
You should note that "ProcessorCount" indicates the number of CPU processors at the machine.

  1. MaxConcurrentCalls

    Defines the total number of concurrent calls that the service will accept.

    Prior to .NET 4.0 the default value is 16, whereas in .NET 4.0 the default value is 16 * ProcessorCount.

    In practice, the amount of calls your service will actually handle depends on the concurrency mode your service is configured with.

  2. MaxConcurrentSessions

    Defines the total number of sessionful channels that the service will accept.

    Prior to .NET 4.0 the default value is 10, whereas in .NET 4.0 the default value is 100 * ProcessorCount.

    This setting affects only sessionful channels where a session is represented by each proxy created by the client.

    If a client calls through a sessionful channel which needs to be created and the limitation is exceeded, the request will be queued.

  3. MaxConcurrentInstances

    Defines the total number service instances that will be created for servicing requests.

    Prior to .NET 4.0 the default value is 26, whereas in .NET 4.0 the default value is 116 * ProcessorCount (the sum of the previous two).

    In practice, the amount of service instances that will actually be created depends on the instance context mode your service is configured with.

    If your service is configured as per-session, the maximum number of instances and sessions will be the minimum value between the MaxConcurrencySessions and MaxConcurrancyInstances.

    If your service is configured as per-call, the setting limits the number of active service instances. If exceeded, new requests will be queued.

    If your service is configured as single, this setting is ignored.

Finally, WCF 4.0 has surely made the default values a bit more practical. In spite of that, I still recommend paying a visit to that behavior and set it differently if needed.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Amir Zuker
Architect Sela
Israel Israel
An experienced software architect in .NET and Microsoft tools.

My fields of expertise are SOA, Cloud Principles, Advanced Client Technologies (WPF, Silverlight) and .NET 4.0 altogether.

In recent years my job included designing and developing high-end distributed applications as well as managing teams professionally, applying presentations and workshops to different divisions.

You may also be interested in...

Comments and Discussions

 
GeneralUsing WCF-Custom adapter to call Secure WCF service Pin
darshanjbhatt19-Jan-11 18:53
memberdarshanjbhatt19-Jan-11 18:53 
GeneralRe: Using WCF-Custom adapter to call Secure WCF service Pin
Amir Zuker22-Jan-11 7:15
memberAmir Zuker22-Jan-11 7:15 
GeneralRe: Using WCF-Custom adapter to call Secure WCF service Pin
darshanjbhatt22-Jan-11 7:20
memberdarshanjbhatt22-Jan-11 7:20 
GeneralRe: Using WCF-Custom adapter to call Secure WCF service Pin
Amir Zuker22-Jan-11 8:57
memberAmir Zuker22-Jan-11 8:57 
QuestionMaxConcurrentSessions property Pin
amoshchmon22-Jul-10 0:30
memberamoshchmon22-Jul-10 0:30 
AnswerRe: MaxConcurrentSessions property Pin
Amir Zuker22-Jul-10 2:08
memberAmir Zuker22-Jul-10 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 3 Jul 2010
Article Copyright 2010 by Amir Zuker
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid