Wcf configuration – Throttling settings

12 במאי 2009

תגיות: ,
אין תגובות

In my pervious post I explained how to define the wcf service concurrency and instance context modes. In this post I will show you how to control these specific numbers (number of calls and number of instances). In wcf you can set these values using throttling settings. Like all other wcf configuration you can set it by using a configuration file or to implement it directly in your source code. The throttling configuration contains three elements:

1. maxConcurrentCalls [default: 16]:

Refer to the service concurrency mode. In a case we define the service as a multiple concurrency mode, it'll define the number of threads we open in the service to handle requests. But, in a case we define the service as a single concurrency mode the service will ignore this value (because we have only single thread in the service anyway).

Increase this number if your service needs to process large number of requests at the same time

2. maxConcurrentInstances [default: Int32.Max]:

Like the maxConcurrentCalls configuration it depends on other configurations.

If we define the service instance context mode to be Single the service will be ignore this value. In case the instance context mode set to per session, the real sessions number will be the minimum value between the maxConcurrencySessions and maxConcurrancyInstances. In case you define the service instance context mode as per call, it'll limit the number of active service instances. If the maximum number of instances exceeded all, the new requests will be queued.

Increase this number if you are using InstanceConcurrancyMode.PerCall or InstanceConcurrancyMode.PerSession and you have lightweight instances with heavy operations.

3. maxConcurrentSessions [default: 10]:

Refer only to a channel which supports sessions (like TCP) in all combinations of InstanceContextMode and InstanceConcurrencyMode configurations. Limits the number of active sessions in the service. Each time the client creates a new channel to the service it creates a new session in the service side (again, only for supported channels). Only when you close the channel gracefully (or after a timeout in the service side) the session will be released.

Increase this value if you have a lot of open channels to the service (and especially when some of them aren’t been closed gracefully…)

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. (*) שדות חובה מסומנים