Share via


Profiling WCF/WF Applications with VS Performance Profiler

There are tons of good articles and blogs out there regarding how to use Visual Studio Team System (VSTS) performance tools (vsperfcmd.exe etc under "%ProgramFiles%\Microsoft Visual Studio 8\Team Tools\Performance Tools" if you have installed VSTS) to generate profiles for native and managed applications. Nothing is actually special for WCF applications here. The reason why I write this short blog is to simply give you a starting point on how to investigate performance of a Windows application (not just WCF/WF) with a common performance language – VSTS profiler.

When you have an application, you would want to know “where does my application spend its time?” and “where are the hot spots or bottlenecks”?

To answer these questions, you need a powerful performance tool. Have you used VSTS performance tools? Have you heard of different modes of profiling (instrumentation vs sampling)? Do you know the command-lines for the VSTS profiler in generating profiling data files? Do you know how to use the cool features of the tools to analyze the performance of your applications? Here are some good articles about how to use this powerful performance tool to investigate performance issues.

How to profile the startup of a managed application?

You can use the “/launch:” feature as following in IanWho’s blog:

https://blogs.msdn.com/ianhu/archive/2005/11/15/493110.aspx

How to profile an application by skipping the startup?

You can use the “/attach:” feature as following in Tim Cahill’s blog:

https://blogs.msdn.com/timothyc/archive/2006/03/08/546437.aspx

How to profile an ASP.NET application?

You can find useful “/globalxxx” flags in David Gray’s blog:

https://blogs.msdn.com/graycode/articles/aspnetoffroadprofilingarticle.aspx

It’s also summarized in the VSTS’s TechNotes:

https://msdn2.microsoft.com/en-us/teamsystem/aa718860.aspx

How to profile a Windows Service?

You can find details in Richard Wurdack’s blog:

https://blogs.msdn.com/angryrichard/articles/Profiling_Windows_Services.aspx

It’s also summarized in the VSTS’s TechNotes:

https://msdn2.microsoft.com/en-us/teamsystem/aa718870.aspx

How to profile a self-hosted WCF service application?

This is not special topic. Here are simple steps:

· Set the profiling environment with “VSPerfCLREnv.cmd /sampleon”.

· Start the WCF service application.

· Disable the profiling environment with “VSPerfCLREnv.cmd /off”.

· Start the WCF client application.

· Attach the profiler to the WCF service application:

VSPerfCmd.exe /output:C:\TEMP\trace.vsp /start:sample /attach:<your service app> [/timer:<sampling timer>]

· Shutdown profiler etc.

You can find more useful links regarding more details about the VSTS performance tools and how to use the tools to analyze the performance of your products as following:

Tech Notes: https://msdn2.microsoft.com/en-us/teamsystem/aa718845.aspx#Development

IanWho’s blog: https://blogs.msdn.com/ianhu/default.aspx

VSTS profiler FAQ: https://blogs.msdn.com/ianhu/archive/2006/04/07/571050.aspx

Comments