Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get started with WCF Performance profiling

I'm trying to figure out how to profile a WCF service so I can identify any bottlenecks.
I have found a bit of information on line, but nothing that assumes no prior knowlege which is where I'm at.

What are recomended FREE tools?

- visual studio tools
- clrprofiler 

Here is information I found using vsperfcmd.exe to profile wcf service and according to this it is very simple, but I need to fill in the gaps on where to start. My assumptions are to copy VsPerfCLREnv and VsPerfCmd to the server that hosts my wcf service and perform some configuraiton steps that I'm not quite sure on. I'm also not quite sure how I would be able to see the call stack to evaluate the performance of each call.

clrprofiler seems a bit simpler. I assume I would copy clrprofiler.exe to the server, File->Profile Service and add the name and start/stop commands. (is this a friendly name or filename or the service display name?) I assume I would then run my tests against the service and I could see the call stack in clrprofiler. Does that sound correct?

[edit]
I'm not so interested in testing the network since this is on a test server, and this is a large wcf project with multiple devs on it and I am unable to make changes to the project for the sole purpose of monitoring the performance. I want to focus on the performance of the actual methods within it.

Any assistance on getting started is greatly appreciated.

like image 683
earthling Avatar asked Oct 14 '10 19:10

earthling


3 Answers

For WCF it is not enough to profile your code only as bunch of things happen on the channel stack (security, deserialization, formatting etc). A good way to visualise that is by using WCF Tracing at verbose level and then using the service trace viewer to see how long it is taking at each step of message processing. Read here on how to configure and use WCF tracing. This is the single most thing that has hepled me with diagnosing WCF issues.

Of course all other code profiling, DB profiling etc. are valid approach as well. You may even use a tool like SoapUI to test your network communication and client side performance overhead for a more end-to-end benchmark.

like image 128
softveda Avatar answered Oct 31 '22 15:10

softveda


some things I've learned that someone might find helpful:

you cannot remote profile a service, even over your local network. The profiler must be running on the same machine as the service. (This actually took me quite a while to figure out. Maybe obvious to you, but it was never spelled out so I kept trying to do it)

Visual Studio didn't work for me to profile my WCF service. I was able to get a bit of help from the VS profiler team, but never came out of it with a working solution.

VS was slow to connect and disconnect the profiler and often instrumented my binaries and left them in a corrupted state.

.net binaries do not need to be instrumented since they contain the metadata of the methods which is odd that visual studio kept hosing my binaries trying to instrument them.

I also tried the VS standalone profiler but this is very complex to use and requires reboots of my server.

I ended up getting an internal profiler to work (after getting a private build from the team) so I'm not sure how many profilers out there are designed to work with a WCF service.

I actually set the profiler to watch the WAS service and then added my additional binaries to the profiler.

process explorer is useful when troubleshooting if the profiler is connected or not. Use it to look at inetinfo.exe environment

like image 5
earthling Avatar answered Oct 31 '22 14:10

earthling


Can you run it under a debugger?

Can you stand a simple, old-fashioned, method that just works? Here's one.

like image 1
Mike Dunlavey Avatar answered Oct 31 '22 14:10

Mike Dunlavey