Click here to Skip to main content
Click here to Skip to main content

WCF Service Performance Monitoring using “Perfmon”

, 31 Jul 2012
Rate this:
Please Sign up or sign in to vote.
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.

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

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.

     

  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.

  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.

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.  

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)

About the Author

Milan Raval
Technical Lead IGATE
India India
Programming Passion: C#, WPF, WCF
 
@:milanraval@gmail.com
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
QuestionPerformance Counters PinmemberRock (Multithreaded)27-Apr-14 9:51 
QuestionThanks PinmemberGen Erike28-Jul-13 1:17 
GeneralNice information Pinmember@AmitGajjar31-Oct-12 1:36 

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

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 31 Jul 2012
Article Copyright 2012 by Milan Raval
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid