WYSIWYG

http://kufli.blogspot.com
http://github.com/karthik20522

Thursday, June 11, 2009

Using Debug Diagnostics to extract and analyse Memory Dump

Download Links:

TinyGet: http://www.microsoft.com/downloads/details.aspx?FamilyID=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en

DebugDiag: http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&displaylang=en

Since I primarily work on web-applications (ASP.NET 2.0) it has become a reflexive action to check for any memory leaks or memory buildup and always try to refactor the code for smaller memory footprint and speed optimization. Since most of the primary test is done on the development machine (Windows XP IIS 5.5), I use TinyGet to simulate traffic to the particular page that I intend to test. Though I am a big fan of JMeter but I still prefer using TinyGet due to the ease-of-use.

* Before we can use TinyGet to simulate the traffic, we need to activate the DebugDiag to capture the memory of the IIS worker process. In the Debug Diagnostics tool, navigate to the "Processes" tab and right click on the w3wp.exe or aspnet_wp.exe process and select the "Monitor for leaks" option.



* Once Monitoring is tracking use tinyget to simulate request to the test page. Below command simulates 900 requests to the default.aspx page on localhost (server) and running on port 80. The "-h" parameter displays the header information of the page requested.

c:\>tinyget -srv:localhost -port:80 -uri:/default.aspx -loop:900 -h



* Once the traffic simulation is done using TinyGet, extract the memory dump by right clicking the aspnet_wp process and selecting the "create full memory dump" option.



* After extracting the memory dump file, navigate to the "Advanced Analysis" and choose "Memory Pressure Analyzer" and selected the dump file as the Data File.



By default Debug Diagnostics tool has two Analysis Scripts namely "Crash/Hang Analyzers" and "Memory pressure Analyzers". One another useful script is the "DotNetMemoryAnalysis" script written by Tess Ferrandez [http://blogs.msdn.com/tess/archive/2009/05/12/debug-diag-script-for-troubleshooting-net-2-0-memory-leaks.aspx]. Following is an example screen shot of analysis result:



Debug Diagnostics is a pretty useful and powerful tool for a quick analysis of memory and crash dump analysis. It gives you a quick peak into number of threads, memory usage and availability in the Heap and fragmentation information and lot's more data to drool about. A very handy tool for a performance and debug engineer!

Labels: , ,