WCF cannot reach 100% CPU. What is a bottleneck?

I compare the stand-alone hosting of the nettcp WCF service, making requests from 50 threads to a service located on more than one computer. The problem is that the processor load never exceeds 35% on the Xeon E3-1270. When I run the same test on a dual-core laptop, it reaches 100%.

The WCF method does nothing, so it should not be limited to IO. I tried to increase the number of threads, but this does not help. Each thread creates a service channel and makes thousands of calls reusing this channel instance.

Here is the class of service that I use:

[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] public class TestService : ITestService { public void Void() { // DO NOTHING } } 

Configs:

ServiceThrottlingBehavior: MaxConcurrentCalls = 1000 MaxConcurrentInstances = 1000, MaxConcurrentSessions = 1000

NetTcpBinding ListenBacklog = 2000 MaxConnections = 2000

+4
source share
1 answer

I would try to change my InstanceContextMode instance to PerCall . I am sure that your current setting will be ignored, because WFC only ever creates one instance of your class and will process them in order. With PerCall, a new instance will be created for each request until the maximum number of threads or configuration limit is reached. You also do not need to set the netTcpBinding value, but keep your Throttling behavior, but make sure that you use your proportions correctly, otherwise there may be adverse consequences.

  • MaxConcurrentCalls: 16 * Number of processors
  • MaxConcurrentSessions: 100 * Number of processors
  • MaxConcurrentInstance: Sum (116 * Number of processors)
+1
source

Source: https://habr.com/ru/post/1381722/


All Articles