Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto generate w3wp.exe process dump file when CPU threshold is reached even when PID changes

Tags:

pid

w3wp

procdump

I'm trying to troubleshoot an issue with one of our websites which causes the CPU to spike intermittently. The site sits on a farm of web servers and it intermittently happens across all servers at different times. The process which causes the spike is w3wp.exe. I have checked all the obvious things and now want to analyse multiple sets of dump files for the w3wp.exe which causes the spike.

I'm trying to automatically generate a dump file of the w3wp.exe process when it reaches a specified CPU threshold for a specified time.

I can use ProcDump.exe to do this and it works a treat IF it's fired before the PID (Process ID) changes.

For example: procdump -ma -c 80 -s 10 -n 2 5844(where 5844 is the PID)

  • -ma Write a dump file with all process memory. The default dump format includes thread and handle information.
  • -c CPU threshold at which to create a dump of the process.
  • -s Consecutive seconds CPU threshold must be hit before dump written (default is 10).
  • -n Number of dumps to write before exiting.

The above command would monitor the w3wp.exe till CPU spikes 80% for 10 seconds and it would take full dump at least for two iterations.

The problem:

I have multiple instances of w3wp.exe running so I cannot use the Process Name, I need to specify the PID. The PID changes each time the App Pool is recycled. This causes the PID to change before I can capture multiple dump files. I then need to start procdump again on each web server.

My question:

How can I keep automatically generating dump files even after the PID changes?

like image 868
phil Avatar asked Nov 12 '22 12:11

phil


1 Answers

USe DebugDiagnostic 2.0 from Microsfot: https://www.microsoft.com/en-us/download/details.aspx?id=49924

It handles multiple w3wp.exe processes. If you need a generic solution, you will have to write a script - such as https://gallery.technet.microsoft.com/scriptcenter/Getting-SysInternals-027bef71

like image 92
matra Avatar answered Dec 15 '22 06:12

matra