views:

83

answers:

4

Hello, 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.

+1  A: 

Can you run it under a debugger?

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

Mike Dunlavey
+1  A: 

In addition to Mike's comments, you can use the built-in WCF performance counters to see a number of performance-related metrics and you can also see call times on a WCF trace. Once you know which operations are 'slow' it's usually easier to add some custom timing/logging code to those operations than using a general purpose profiler for something like this. This coming from someone who used to work on commercial profilers.

500 - Internal Server Error
+1  A: 

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.

Pratik
Yes. The way I handle asynchronous situations is 1) use random-pause on threads to make sure they are as efficient as possible, and then 2) do detailed message logging, merged across processes. I won't say studying message traces is easy, but it is effective. To me, it was surprising how fast an asynchronous message-passing protocol could be made to run.
Mike Dunlavey
thanks, I'm looking into the wcf tracing, but I'm not sure what to look for in the output. I'm primarily interested in the performance bottlenecks of the server vs network communication and client. I have a few target methods I want to analyze and see where improvements might be made.
senloe
If you open the trace in service trace viewer you will see all activities in a soap message processing. One of them is Execute User Code activity and see how much time is spend. This will give you idea how much time your code is taking to execute. But indeed if you need to drill down performance bottleneck in your code you have to use a profiler like the built-in Visual Studio profiler or the excellent nants performance profiler from RedGate.
Pratik
That's what I figured. I'm trying to use the built-in profiler in VS2010, but as soon as I add the dll to the solution and mark it to instrument, I can no longer connect to the service. I can see on the server that the original dll is being backed up and a new copy put in place.
senloe
+1  A: 

Tools you should look into: svctracelogviewer (and turn on tracing in both your service and clients). SoapUI for simulating load (and do analysis) and Fiddler, an excellent HTTP sniffer/diagnostics tool.

larsw
do you know how to use fiddler to monitor the wcf traffic? I'm using the wcf test client and don't get any info in fiddler.
senloe
Are you trying to use Fiddler against a service running on localhost? If so, look into the documentation what you need to do in order to get it to work.
larsw
The service is hosted on a test server. Now that I think about it, I'm not sure if this is possible with fiddler since the service is using tcp binding. Perhaps this is a question better left for a new thread.
senloe