Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Throttle Settings

Tags:

c#

wcf

msmq

I have been working on a proof of concept using WCF and MSMQ. I have been playing around with the throttle settings using the defaults This Article and also adding my own settings to the config file. I have 2 Quad Core Xeon CPUs running this application. No matter what settings I apply it always only appears to grab 8 messages at a time (Which matches my processing cores). I want each of the messages to be handled in a single transaction so that could be part of the issue...not sure. I jsut assumed it would handle a lot more messages concurrently than it is.

Service Behavior:

   [ServiceBehavior(UseSynchronizationContext = true,
                     ReleaseServiceInstanceOnTransactionComplete=true,
                     ConcurrencyMode = ConcurrencyMode.Single,
                     InstanceContextMode = InstanceContextMode.PerCall)]

Endpoint Behavior:

  <endpointBehaviors>
    <behavior name="endpointBehavior">
      <transactedBatching maxBatchSize="1" />
    </behavior>
  </endpointBehaviors>

My own Service Throttling:

<serviceThrottling maxConcurrentCalls="128" maxConcurrentSessions="800" />

Am I overlooking something? Maybe I just don't fully understand the default / custom throttle settings (Likely).

EDIT

I have modified the ConcurrencyMode (Changed to Multiple) along with the ReleaseServiceInstanceOnTransactionComplete setting. Changing to Multiple didn't seem to change anything?

EDIT Is it maybe the TransactionBatch setting? I have that set to one...?

Thanks,

S

like image 758
scarpacci Avatar asked Jan 05 '12 16:01

scarpacci


People also ask

How to use throttling in WCF?

Throttling controls place limits on the number of concurrent calls, instances, or sessions to prevent over-consumption of resources. Throttling behavior is specified in service configuration file settings. This sample is based on the Getting Started that implements a calculator service.

What is throttling c#?

It means the client only creates maximum number for the concurrent calls, sessions and instances as per throttling behavior. If the client crosses the limit, then the Service will not allow doing this. As shown above, you can specify the throttling in two ways; i.e., in config file and at hosting time.

What is the default MaxConcurrentSessions?

maxConcurrentSessions. A positive integer that limits the number of sessions a ServiceHost object can accept. The service will accept connections in excess of the limit, but only the channels below the limit are active (messages are read from the channel). The default is 100 * processor count.

What is the default max concurrent sessions in WCF?

The default value for this setting is 2,147,483,647. MaxConcurrentSessions. Limits the number of active sessions allowed for the service.


1 Answers

I found a blog that pointed me to some good documentation on WCF throttling / performance. I added some more meta output to my processing application and was able to get the performance I was looking for. By adding more information to my process (ManagedThreadID, etc) I could see I was getting a lot more throughput than I had originally assumed. I also found some of the tips in the blog below to be helpful.

Blog

Thanks,

S

like image 71
scarpacci Avatar answered Oct 21 '22 02:10

scarpacci