tags:

views:

91

answers:

4

Hi,

I'm using perfmon to examine my service behaviour. What I do is I launch 6 instances of client application on separate machines and send requests to server in 120 threads (20threads per client application).

I have examined counters and maximum number of instances (I use PerSession model and set number of instances to 100) is 12, what I consider strange as my response times from service revolve around 120 seconds... I thought that increasing number of instances will cause WCF to create more instances, and as a result response times would be quicker.

Any idea why WCF doesn't create even more instances of service?

Thanks Pawel

A: 

You might want to refer to this article and make adjustment to your WCF configuration (specifically maxConnections) to get the number of connections you want.

Consider using something like http://www.codeplex.com/WCFLoadTest to hit the service.

Also, perfmon will only get you so far. If you want to debug WCF service you should look at the SvcTraceViewer and SvcConfigEditor in the Windows SDK.

Matthew
maxConnections attribute? Where should I apply it? To binding configuration?
dragonfly
A: 

On your service binding what have you set the maxconnections to? Calls to connect will block once the limit is reached.

Default is 10 I think.

http://msdn.microsoft.com/en-us/library/ms731379.aspx

MattC
I use my user-defined binding. And when I add that configuration attribute to my binding configuration a get exception:Unrecognized attribute 'maxConnections'
dragonfly
And I use http transport
dragonfly
Ah, ok basicHttpBinding is connectionless so doens't have that attr.Have you tried the throttling marc_s suggested above?
MattC
Yes I did. Maybe there is restriction/limit setting on client side?Once again: I run 20 threads in every of 6 instances on separate machines...
dragonfly
+1  A: 

WCF services are throttled by default - it's a service behavior, which you can tweak easily.

See the MSDN docs on ServiceThrottling.

Here are the defaults:

<serviceThrottling 
    maxConcurrentCalls="16"   
    maxConcurrentInstances="Int.MaxValue"
    maxConcurrentSessions="10" />

With these settings, you can easily control how many sessions or concurrent calls can be handled, and you can make sure your server isn't overwhelmed by (fraudulent) requests and brought to its knees.

marc_s
+1  A: 

Ufff, last attempt to understand that silly WCF.

What I did now is:

  • create client that starts 20 threads, every thread sends requests to service in a loop. Performance counter on server claims that only 2 instances of service object are created all the time. Average request time is about 40seconds (I start measuring before proxy call and finish after call returns).

  • modify that client to start 5 threads and launch 4 instances of that client (to simulate 20 threads behaviour from previous example). Performance monitor shows that 8 instances of service object are created all the time. Average request time is 20seconds.

Could somebody tell me what is going on? I thought that there is a problem with server that it doesn't want to handle more requests at concurently, but apparently it is client that causes a stir and don't want to send more requests concurently... Maybe there is some kind of configuration option that limits client from sending more then two requests at one time... (buffer,throttling etc...)

Channel factory is created in every thread.

dragonfly