I have a WCF service (basicHttpBinding) hosted in II7 on Vista that I expect to handle many requests concurrently. I'm attempting to load test the service by spawing 200 threads in a test app and calling the WCF service. I've run this test app on the same machine as the server as well as multiple other computers and I always get the same result - no more than 5 workers are used. Is this a WCF, HTTP or IIS bottleneck?
问题:
回答1:
This is a feature to prevent denial of service attack. Out of the box, WCF is designed to be secure. Check the service behavior, look in msdn for maxConcurrentCalls and maxConcurrentSessions configuration. I think the limit is 10, but I could be wrong.
回答2:
Here's a nice article on WCF Instance Management from MSDN magazine by Juval Lowy: http://msdn.microsoft.com/en-us/magazine/cc163590.aspx Issue from June 2006 (in case if MSDN will butcher their links again).
It explains techniques and settings for managing service lifecycle (throttling is one of them) and shows what settings to apply to increase number of concurrent connection.
回答3:
WCF is secure by default. This means that the default settings limit what you can do with your WCF service to avoid things like denial of service attacks. This is great for internet facing web services, but it can sometimes bite you. Depending on what bindings and behaviors you use, it could be a setting in any of those.
Here is an overview of these settings - it'll require some experimentation on your part to determine what exactly is biting you.
回答4:
No, it's just the default throttling settings in WCF. It's configured in the serviceThrottling element of a behaviour in the service config file, which has a maxConcurrentSessions attribute. Default 5, but you can set it to whatever you want.
回答5:
As of .NET 4.5, the default number of connections is (100 * number of processors) - ServiceThrottlingBehavior.MaxConcurrentSessions Property