WCF Performance Counters

Note: Cross posted from Sajay.

We generally need to have a quick set of performance counters to identify a performance issue with a service. Shown below are three new counters that you will find with WCF 4.0. I also want to emphasize on the Calls outstanding counter here since this is one very useful and is indicative of calls getting queued up.

PercentOfMaxCalls

Reports # of active requests as % of max calls

Reports the numbers of messages being processed + in the wait queue as a percentage of MaxConcurrentCalls throttle

PercentOfMaxSessions

Reports # of active requests as % of max sessions

Reports the numbers of active instances + calls in the wait queue waiting for an instance as a percentage of MaxConcurrentInstances throttle

PercentOfMaxInstances

Reports # of active requests as % of max instances

Reports the numbers of messages in the wait queue due to MaxConcurrentSessions throttle

CallsOutstanding ( from 3.0)

Reports the # of calls waiting to be completed

Reports the number of in-progress calls to this service.

Here you see that the %Instance throttle has maxed out. What do you think we should do? You can guess what throttle we are hitting here.

Perfmon

 

Counters

Some common questions when trouble shooting performance problems:

Why are my clients timing out, the service is showing 100% for % of MaxConcurrentCalls?

% of MaxConcurrentCalls gives you an indication of how much closer you are to hitting your max throttle value. This means that if you have a max concurrent call of 10 and you have 10 outstanding calls then you have utilized 100% of your throttle and there is no more work that your service can do. So if you see that your % maxConcurrentCalls is very high it probably indicates you have a very low throttle value. Remember the default is 16 till v3.5 and 16* proc count for v4.0.  Before 4.0 you needed to work this out by checking the calls outstanding throttle and your web.config to figure out this value. These new % performance counters would help you identify if you are hitting the max values from now.

What if % MaxConcurrentSessions is showing 100% ?

We have bumped up the default number of sessions for service throttling behavior to 100 per CPU. But then again if you are seeing that %MaxConcurrentSessions is very high  this means that you have exhausted all your session. This is probably because your clients are not closing either proxies and terminating sessions when you have less clients or possibly due to a very small MaxConcurrentSessions configuration.