Reputation: 285
We are working on a web application which used WCF Restful services extensively. On the coming Christmas and New year eve we are expecting heavy traffic and management decided to improve the performance of our application.
But I am not sure How to measure performance of each service.
What are the standard methods, approaches and tools used to measure performance of given WCF Service?
Upvotes: 1
Views: 1385
Reputation: 2541
1) You can use WCF extensibility to intercept WCF methods invocation.
See: IParameterInspector (Simple profiler)
and
Message Inspectors here and here.
2) More universal approach is to use 'regular' interсeptors. If you build dynamic interceptor-proxy (I recommend to use castle dynamic proxy or very powerful impromptu interface for this) for your Wcf service implementation (or any class you need to measure performance) - you will be able to manually measure method calls with stopwatches and log results as you want with some extra info.
Good practice is to register (switch) concrete interface implementations with dependency injection frameworks. Some of them supports WCF integration facilities (links: Autofac, Windsor, Ninject) and dynamic proxy (links: Autofac, Windsor, Ninject).
Upvotes: 0
Reputation: 5322
Have a look at the built-in performance counters
You can enable them by adding this to your configuration:
<configuration>
<system.serviceModel>
<diagnostics performanceCounters="All" />
</system.serviceModel>
</configuration>
Restart your service.
Start the application "perfmon.exe" Performance Monitor, don't confuse with Windows Performance Analyzer.
Select Monitoring Tools -> Performance Monitor
Click on the green PLUS button
Select ServiceModelService 4.0.0.0 and find you instance.
Select your instance and click add
Select OK
Now you have a lot of information avaiable.
Upvotes: 3