I have been absolutely swamped lately with work, and in particular determining and rectifying performance issues with a major ASP.NEt application we are developing. Measuring, tuning, rectifying and reporting are all part of my current tasks. We are using only out of the box tools to do so, in particular, the CLR Profiler for memory profiling and Microsofts Application Centre Test for generating load. During this task, I have learned a couple of things. What is one of the most useful features of the .Net framework, but also one potentially one of the most dangerous?
Well, my answer is the Garbage Collector, or GC as its tentatively known. Its a fantastic thing, in that resources and memory is cleaned up on your behalf in a very efficient manner, eliminating some of the requirements of the old C/C++ days of manually having to release everything. It can also be lull developers into a false sense of security, especially where memory usage and performance is concerned. During my profiling of certain elements of the application, it became apparent that objects were being created and used all over the place, with the assumption that the GC would collect them later. Well as you can imagine, this lead to inefficient performance and memory consumption in many areas.
The CLR Profiler has been an invaluable tool for aiding me in determining whats going on, and where in the various parts of the application, which itself is quite large and complex.
Take a look at the comparitive "Histogram by Age" charts below.
Here is a link to the before image, and here is the after image.
This was from an isolated part of the application but is indicative of one of the many improvements that have been made using this tool.
This will also be part of a presentation that I hope to be making at TechEd 2005 in Australia at the Gold Coast later this year. I certainly have not been confirmed in any way, but have voiced my wish to present this kind of material. Hopefully, I get a chance to do so. If you feel this would be valuable, or even if you think it wouldn't be, I'd love to hear your opinion.