When I enable trace, e.g.:
How badly this affects application performance?
When I enable trace, e.g.:
How badly this affects application performance?
As with most questions, the answer is "It depends". Are you turning on Tracing for WCF components, or using your own trace calls? Is there a trace listener attached (e.g. writing to a file? Or is a DebugView tool opened to watch the system debug console)? Does your code make heavy use of tracing in tight loops, or does it do more moderate tracing only on non-recursive functions and the like?
You can try it and see, but for most apps, you will notice.
I had the same question since I'm considering the impact of leaving verbose tracing on in production for the first several months on a multi-tiered system.
The test I've performed indicates it's not too bad a performance hit. Here's the sequence of calls I'm making:
UI Client (local pc) -> WCF service 1 (hosted locally) -> WCF service 2 (hosted locally) -> webservice hosted by business partner (offsite)
The UI client, as well as WCF Service 1 and WCF Service 2 are all tracing using System.Diagnostics.XmlWriterTraceListener.
Set to "ALL", the process averages 530ms.
Set to "OFF", the process averages 400ms.
That's a pretty big jump, but the actual processing happening is trivial, so this is almost ALL serialization & communications overhead. I suspect as the tasks become more processor-intensive, the logging overhead will decrease as a percentage.
If you're making a high volume of calls, and need performance, that overhead might be unacceptable. But in my case, the calls will be infrequent, so the small additional overhead will be worth the diagnostic potential.
Be sure to < clear /> the default listener if you're worried about performance.