In fact, it's already the case since .net 4 (see blog post here). However, only the number of processor is important.
- MaxConcurrentSessions: default is 100 * ProcessorCount
- MaxConcurrentCalls: default is 16 * ProcessorCount
- MaxConcurrentInstances: default is the total of the above two, which follows the same pattern as before.
HTTP is a stateless protocol and it's recommanded to avoid using session on server side, for scalability. A typical front end server, consumme CPU and not memory (ScaleOut Vs ScaleUp).
However, WCF limits, aka WCF throttling is just a behavior. You add/edit this behavior at startup using a ServiceHost a custom ServiceHostFactory.
ServiceThrottlingBehavior throttle = new ServiceThrottlingBehavior();
throttle.MaxConcurrentCalls = /*what you want*/;
throttle.MaxConcurrentSessions = /*what you want*/;
throttle.MaxConcurrentInstances = /*what you want*/;
ServiceHost host = new ServiceHost(typeof(TestService));
// if host has behaviors, remove them.
if (host.Description.Behaviors.Count != 0)
{
host.Description.Behaviors.Clear();
}
// add dynamically created throttle behavior
host.Description.Behaviors.Add(throttle);
//open host
host.Open();
You can achieve the same using a custom ServiceHostFactory.
<%@ ServiceHost Language="C#" Debug="true" Service="MyWebApplication.TestService"
Factory="MyWebApplication.TestServiceHostFactory" %>