Debug Tools to analyse IIS process

Published:
Debug Tools to analyse IIS process:

This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage.

To take dumps,download the following.

Install1: To start with you need to download the debugging tools which can be found at http://msdn.microsoft.com/en-us/windows/hardware/gg463016. Install it on the machine(webserver) where application is running in IIS to take dumps.

Install2: Download symbols from http://msdn.microsoft.com/en-us/windows/hardware/gg463028 and install or you can copy to shared path.


Steps to take dumps:

Step1: Get the process ID for the IIS worker process. You can get either from taskmanager and selecting PID to get it or Run IISapp from C:\<windowsdirectory>\System32.

Step2: Adplus will take dump at current state of CPU/IIS process. Make sure to take dumps when CPU is very high. Now goto path where you installed debugging tools earlier.i.e(C:\Program Files\Debugging Tools for Windows (x86)). Here we need to run adplus command. Example(C:\Program Files\Debugging Tools for Windows (x86)>adplus.vbs -hang -p 492) 492 is process id from step1.

Result: This will create the dump in same path with date and timestamp. The directory contains the dmp file, txt file, adplus report, process list with PID appended.


Steps to analyse the results:

Now that we have taken dumps you can analyse on the same machine or on different machine.

Step3: Goto Start->Program files->Debugging tools for windows(x64) and open WinDbg. It will open the Dump editor.

Step4: Goto File -> select Open Crash Dump and select the dmp file taken from Step2.It will open the small command window and will have command box to type.

Step5: You need to load symbols from Install2(from above)i.e C:\symbols or \\sharepath\symbols.
Type in small command window: .sympath+ C:\symbols
To load symbols Type:  .reload
To load mscorwks lib Type:  .loadby sos mscorwks
To display time consumed by each thread Type: !runaway
Output will be something like this...
 0:000> !runaway
                       	User Mode Time     Thread  Time
                       	92:25b0          0 days 0:01:43.546
                       	96:2418          0 days 0:01:39.796
                       	22:2314          0 days 0:01:39.671	

Open in new window

Now to check the thread which hangs/causes high cpu Type: ~92s
To view the calls Type: !clrstack  this will display all the methods/call from the code which is running at that point of time.You can further analyse the code for optimization.


Some of the commands which can be helpful.

!eeversion
!threadpool
!Analyze -v
_NT_SYMBOL_PATH=SRV*C:\MyLocalSymbols*http://msdl.microsoft.com/download/symbols  - to set symbols
.help
!help - will give all the commands.

Cheat sheet for the commands can be found @ http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx
3
5,595 Views

Comments (2)

Author

Commented:
why is this neglected ?
Hello Pramod i am looking for desperate help on IIS could you please email your contact details to my email ID indian803@gmail.com i wil ltouchbase with u

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.