How to increase WCF Throttling for a performance load test - wcf

I am preparing my WCF services for a performance load test. We need to find the system limits.
My understanding is that the default WCF throttling settings will impact performance load tests and does not allow to find the system limit.
What are the configuration settings that I need to increase and loosen up the WCF throttling settings?
So far I have the following items in mind and I wonder if they are accurate or the correct ones?
<behavior name="B1">
<serviceThrottling maxConcurrentCalls="20000" maxConcurrentSessions="20000" maxConcurrentInstances="20000"/>
</behavior>

never forgot to set max connection property:
<system.net>
<connectionManagement>
<add address="*" maxconnection="500" />
</connectionManagement>
the default value is 2. for more information you can read this: scale up WCF service

Related

WCF limitations for concurrent users

I am wondering if is there any user limit in numbers. I mean is there any upper limit for users that can use the WCF service concurrently other than memory limitations? I made a little research but since I don't know the terminology well I couldn't find anything :/ And I can't be sure of that kind of a limitation doesn't exist just because I couldn't find it :)
To prevent overloading of a service, you can specify how many calls can be made and how many sessions or instances can be created. You can do this by configuring the ServiceThrottlingBehavior settings. We can also do this by configuring the serviceThrottling element in app.config. The following throttling properties can be set.
MaxConcurrentCalls : the max number of calls processed at ones by the service.
MaxConcurrentInstances :the max number of service instance objects executing at ones on the service.
MaxConcurrentSessions :the max number of sessions handled at ones by the service.
Here is a sample config :
<behaviors>
<serviceBehaviors>
<behavior name="Throttled">
<serviceThrottling
maxConcurrentCalls="1"
maxConcurrentSessions="1"
maxConcurrentInstances="1"
/>
<serviceMetadata
httpGetEnabled="true"
httpGetUrl=""
/>
</behavior>
</serviceBehaviors>
Depending and your Framework version, the defaults values for all theses settings are not the same (link).

How is a WCF Service and IIS integrated, what is the architecture and flow for incoming requests

I have been technically testing a WCF service recently and have got to the point where, my lack of understanding is not allowing me to progress forward and find a solution to a timeout problem we see.
We are load testing a WCF Service which is hosted on IIS7 on windows server 2008. The system set up to fire the messages actually fires them at an application which is biztalk. Biztalk then process the messages and sends them on to the end point of the WCF Service. The WCF Serviceis also using .net 2.0 in it's app pool (I guess this means it could actually be 3.0 or 3.5 as these were not full releases?
We fire 40 messages within a seconds and 90% of them become timed out due to the send timeout on the client (biztalk). We thought at first this was strange because we expected the server's basic http binding receive timeout to trigger first, but it turned out that was set at 10 minutes and the client send timeout was set at 1Min and 30 Secs.
What I understand:
WCF Services have config files which have inside them behaviors and http bindings. The Server end point we are sending an XML message to is using BasicHtppBindings: Timeouts:Open/Close is 1 Minute, Send and Recieve are 10 minutes. The server's timeout which we know are involved so far is: sendtimeout: 1 minute.
I understand WCF's architecture works by creating an instance of either a channel factory or service host and creates a channel stack which contains the behaviors and binding settings from the config as channels. There is a TransportAdaptor which is used to move the xml message once it has been processed through the channel stack.
I understand from IIS that http.sys handles the incoming requests. It passes requests to the workerprocess and when that is busy, it places requests onto the kernel mode queue? I understand there some machine.config settings that can be set to increase this queue/limit this queue?
I also know about how to make an app pool into a webgarden and I have read you can increase the number of threads per core, from the default of 12; this is don e via a registry setting or a later on in .net a web config change.
I just read about InstanceContextMode and how it can effect the server's service too... But I'm unsure what that is set to in this case.
We recorded some perforamance counters, .net ones and I noticed the number of current requests minus the (Queued+Disconnected) = 12. Which indicates we are using 1 core? and the number of threads of on that core is set to 12.
Can anyone help me for a clearer picture and help piece my knowledge with some extra into something that is more complete?
The WCF Behavior has a throttle setting. Here is an example (grabbed from msdn):
<service
name="Microsoft.WCF.Documentation.SampleService"
behaviorConfiguration="Throttled" />
..... .....
<behaviors>
<serviceBehaviors>
<behavior name="Throttled">
<serviceThrottling
maxConcurrentCalls="1"
maxConcurrentSessions="1"
maxConcurrentInstances="1"/>
</behavior>
</serviceBehaviors>
By default (if not specified), the service is throttled to 10 concurrent calls.
I find that a sensible production setting for high volume clients running short calls is more like 100. Of course it depends on your implementation, but the defualt definitely hurts performance on my test and production systems.

What is the limit of concurrent call to a service on TCP with reliabalesession TRUE?

What is the limit of concurrent call to a service on TCP with reliabalesession TRUE?
That depends on your service throttling settings, and on whether or not you're using sessions.
By default, the server is limited to 16 concurrent calls, and a maximum of 10 concurrent sessions. But this is a server-side setting which can be tweaked.
<behaviors>
<serviceBehaviors>
<behavior name="ServiceThrottling">
<serviceThrottling
maxConcurrentCalls="16"
maxConcurrentSessions="10"
maxConcurrentInstances="20" />
</behavior>
</serviceBehaviors>
</behaviors>
If you do have reliable sessions set to true, you're most important settings are "maxConcurrentSessions" (how many sessions = clients can be connected at any given moment), and "maxConcurrentInstances" (how many instances of your service object can exist at any given time).
Try to set everything to e.g. 20 or so and see how your system behaves. How are clients calling in? Anyone getting rejected? How's the load on your server? Can it handle those 20 callers just fine, or is it almost dead from exhaustion? Tweak your settings accordingly (up or down).
Marc

Where does WCF log the stuff if wmi is enabled?

<system.serviceModel>
<diagnostics wmiProviderEnabled="true">
I recently stumled across this setting in WCF, where you can enabled WMI logging. Where does it log to? and what is logged? There is no mention of that..
Pleaselet me know...
It is explained here and example here.

Determine wsHttpBinding at runtime with WCF

I have a web application that exposes web services using WCF and wsHttpBindings. It is possible to have the application on different machines and different urls. This would mean the WCF service location would be different for each.
I am building a Windows Service that will reference each application and perform a task. Each task needs to call a service on the web application. I understand that the bindings are all setup in the app.config, but is there a simpler way to call the service dynamically, or how would I structure the app.config?
<webApplication WebServiceUrl="http://location1.com/LunarChartRestService.svc" />
<webApplication WebServiceUrl="http://location2.com/LunarChartRestService.svc"/>
Your client's config file could look something like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<client>
<endpoint name="Endpoint1"
address="http://location1.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
<endpoint name="Endpoint2"
address="http://location2.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
<endpoint name="Endpoint3"
address="http://location3.com/LunarChartRestService.svc"
binding="wsHttpBinding"
contract="(whatever-your-contract-is)" />
</client>
</system.serviceModel>
</configuration>
Then in code, you can create such an endpoint (client proxy) based on its name and thus you can pick whichever location you need. There's nothing stopping you from creating multiple client proxies, either! So you can connect to multiple server endpoints using multiple client proxies, no problem.
Alternatively, you can of course also create an instance of "WsHttpBinding" and "EndpointAddress" in code, and set the necessary properties (if any), and then call the constructor for the client proxy with this ready made objects, thus overriding the whole app.config circus and creating whatever you feel is needed:
EndpointAddress epa =
new EndpointAddress(new Uri("http://location1.com/LunarChartRestService.svc"));
WSHttpBinding binding = new WSHttpBinding();
Marc
From your description, it sounds as if all servers are exposing the same service contract. If so, you could very well just declare multiple endpoints in your web.config and choose one at runtime based on the endpoint name.
Of course, it may be that you prefer not to deal with that part of the WCF configuration and would rather just have a simpler list of URLs and be done with it. That's perfectly possible as well; you just need to do a little bit more work on the code side to instantiate the client side proxies / channel objects.