Click here to Skip to main content
15,867,781 members
Articles / DevOps / Testing

WCF Service Performance Monitoring using “Perfmon”

Rate me:
Please Sign up or sign in to vote.
4.95/5 (12 votes)
31 Jul 2012CPOL2 min read 77.1K   2.4K   31   3
This article explain how to use Windows "Perfmon" to monitor WCF service performance.

Introduction

Monitoring .NET application performance using "Perfmon" is not very new to developers. The same tool can be used to monitor WCF service performance also.

Using the code  

Attached a C# solution "PerfCounter" with the article. There are three projects included in it 

  • PerfCounter: It is a default template project that is created when you add new WCF Service library project with GetData method.
  • PerformanceCounterService: It is a Windows Service Host for "PerfCounter". You can compile and install this as a windows service  refer to article for any help : http://www.codeproject.com/Tips/52471/Install-Windows-Service
  • PerformanceCounterClient:It is a console application to see performance counter working

What is “Perfmon” 

Perfmon is a performance analysis and troubleshooting tool. It is able to collect a various performance metrics over time, at specified intervals, and generates logs that can be graphically analyzed to identify problem areas in your system performance.

PerfMon Sample: Demonstrates How to Monitor System Performance Using Performance Counters - http://msdn.microsoft.com/en-us/library/aa645516(v=vs.71).aspx

How to use Perfmon

Go to Windows > RUN

Type “Perfmon” and press enter  this will open Performance Monitor as shown in image below.

Image 1

Open content menu on Graph in the left side and click “Add Counters” this will open a window with various performance counter categories as shown in below image

Image 2

WCF Service and performance counters  

WCF service has number of in build performance counter exposed, which can be used to monitor WCF service. By default the WCF performance counter are turned off because the counter have potential to increase the memory footprint of the WCF application significantly.

WCF Service performance counter categories:

  1. ServiceModelEndpoint
  2. The group of counters is responsible for tracking information about the endpoints for a WCF service. See below screen where PERFCOUNTER service has ServiceModelEndPoint performance counters enabled. Counters can be added for monitoring of all endpoints or specific endpoint of a WCF service.

     Image 3

  3. ServiceModelOperation
  4. The group of counters is responsible for tracking information about the operations within a WCF service. See below screen where PERFCOUNTER service has ServiceModelOperation performance counters enabled. Counters can be added for monitoring of all operations or for specific operation of a WCF service.

    Image 4

  5. ServiceModelService
  6. The group of counters is responsible for tracking information about the WCF service as a whole. See below screen where PERFCOUNTER service has ServiceModelService performance counters enabled.

    Image 5

Enable performance counter for a WCF service 

To enable performance counter for a WCF service modify service host’s configuration file to have diagnostic configuration tag with following possible values.  

Image 6

WCF service performanceCounter configurations can be set to following three values

  1. performanceCounters=”All”, this enables all three categories of counters
    • ServiceModelEndpoint
    • ServiceModelOperation
    • ServiceModelService 
  2. performanceCounters=” ServiceOnly”, only ServiceModelService category counters are enabled 
  3. performanceCounters=” Off”, all ServiceModel performance counters are disabled. This is the default value.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead IGATE
India India
Programming Passion: C#, WPF, WCF

@:milanraval@gmail.com

Comments and Discussions

 
QuestionPerformance Counters Pin
Rock (Multithreaded)27-Apr-14 9:51
Rock (Multithreaded)27-Apr-14 9:51 
QuestionThanks Pin
Gen Erike28-Jul-13 1:17
Gen Erike28-Jul-13 1:17 
GeneralNice information Pin
AmitGajjar31-Oct-12 1:36
professionalAmitGajjar31-Oct-12 1:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.