130 likes | 427 Views
Leveraging Performance counters to build robust applications in .NET. Chandrashekhar Chaudhari Technical Lead | Microsoft http://blogs.msdn.com/dsvc | chancha@microsoft.com. Key Take-aways …. Performance Monitor: What is it? Know the important .NET Performance counters
E N D
Leveraging Performance counters to build robust applications in .NET ChandrashekharChaudhari Technical Lead | Microsoft http://blogs.msdn.com/dsvc |chancha@microsoft.com
Key Take-aways… • Performance Monitor: What is it? • Know the important .NET Performance counters • ASP.NET and Performance Monitor • A quick note on .NET Performance: • Bottlenecks • Possibilities • Way outs
Perfmon: What is it? • The name says it all. • Used to monitor the performance parameters of the system and the user applications. • How to use it? • What are the parameters that we can track?
A few .NET Performance Counters • .NET CLR Memory Counters • .NET CLR Exceptions • .NET CLR Loading • .NET CLR JIT • Processor • Memory
Scenario I: Application Consuming lot of memory • What should I look at? • .NET CLR Memory Counters • Indicators: Memory Leak? • # bytes in all Heaps increasing • Gen 2 Heap Size increasing • # GC handles increasing • # total committed/Reserved Bytes increasing • % Time in GC • Indicators: Memory Fragmentation? • # total reserved Bytes significantly larger than # total committed Bytes • # of Pinned Objects increasing • # GC handles increasing • # bytes in all heaps always increasing.
Scenario II: Application throwing lot of exceptions unnecessarily… • Cost of throwing an exception • What else can go wrong? • Blocking exception handlers • Loss of exception context • Perfmon Exception counters to look at: • # of Exceps Thrown • # of Exceps Thrown / Sec • # of Filters / Sec • Throw to Catch Depth / Sec
Scenario III: Application Takes too long to Load • Possible Reasons: • Too many assemblies to load • Too much of jitting happening. • Perfmon counters to look at: • % Time in Loading • Current Assemblies • Rate of Assemblies/AppDomains • # of IL Bytes JITted • # of methods JITed • % time in JIT
A Quick note on ASP.NET specific counters • Two types: • System Counters • Application Counters • Few important Counters: • ASP.NET/Application Restarts. • ASP.NET/Requests Queued • ASP.NET Application/Requests/sec • ASP.NET Application/Errors Total • AND many more…
.NET Application Performance • Performance is a relative term: • What is good for you may not be good for others. • Performance Bottlenecks in .NET: • Am I loading too many assemblies at the start? • Am I doing too many memory operations? Am I trying to deal with the memory management on my own? • Am I misusing Exceptions and defeating their purpose? • The list is long…
.NET Application Performance • Way outs: • Add trace messages in your application. • Debug it. • Use Debugging tools to do post mortem analysis. • Use Perfmon.
Feedback / QnA • Your Feedback is Important! Please take a few moments to fill out our online feedback form • Use the Question Manager on LiveMeeting to ask your questions now!
Contact (optional slide) • Blog Address www.blogs.msdn.com/dsvc • Email Address chancha@microsoft.com