WCF Throttle Settings
Asked Answered
C

2

6

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

Chaddy answered 5/1, 2012 at 16:55 Comment(1)
Hi @JohnBreakwell I have changed the concurrency mode to Multiple and seemed to be realizing the same results?Chaddy
C
4

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

Chaddy answered 9/1, 2012 at 16:47 Comment(0)
C
0

Since you are running PerCall instancing you should increase MaxConcurrentInstances. Even in .Net 4 the default is 26. In 4.5 "The default is the sum of the default value of MaxConcurrentSessions and the default value of MaxConcurrentCalls.."

BTW... WCF will call into your instance on multiple threads unless you are using InstanceContextMode.PerCall. InstanceContextMode.PerCall+Any ConcurrencyMode = N concurrent invocations of the method on N service instances, where N is determined by the service throttle Reference

Collation answered 10/1, 2012 at 19:29 Comment(2)
I think what you said about PerCall/Single thread is incorrect. All of the service instances will be created on the same thread an thus execute syncronously. You can see for yourself in the [screenshot here](codeproject.com/KB/WCF/WCFConcurrency.aspx#Instance mode = per Call and Concurrency = Multiple). That blog post is very useful and worth reading.Nonsmoker
hmmmmmm i was just regurgitating statements from that reference at the end of my comment.Collation

© 2022 - 2024 — McMap. All rights reserved.