w3wp.exe占用CPU超过50%的处理
1.查看CPU占用高的进程:任务管理器
C:\Documents and
Settings\Administrator>iisapp
W3WP.exe PID: 18008 AppPoolId: STAT
W3WP.exe PID: 8328 AppPoolId: STAT
W3WP.exe PID: 17868 AppPoolId: JYCV16
W3WP.exe PID: 16652 AppPoolId: JYCONLINE
W3WP.exe PID: 1248 AppPoolId: MAIL
C:\Documents and
Settings\Administrator>E:\soft\Procdump\procdump.exe -ma -c
50
-s 3 -n 2
17868
ProcDump v7.1 - Writes process dump files
Copyright (C) 2009-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards
Process: w3wp.exe (17868)
CPU
threshold: >= 50% of system
Performance counter: n/a
Commit
threshold: n/a
Threshold
seconds: 3
Hung window
check: Disabled
Log debug
strings: Disabled
Exception
monitor: Disabled
Exception
filter: *
Terminate
monitor: Disabled
Cloning
type: Disabled
Concurrent
limit: n/a
Avoid
outage: n/a
Number of
dumps: 2
Dump
folder: C:\Documents and Settings\Administrator\
Dump
filename/mask: PROCESSNAME_YYMMDD_HHMMSS
Press Ctrl-C to end monitoring without terminating the
process.
[16:25:34] CPU: 75% 1s
[16:25:35] CPU: 72% 2s
[16:25:36] CPU: 76% 3s (Trigger)
[16:25:36] Dump 1 initiated: C:\Documents and
Settings\Administrator\w3wp.exe_16
0110_162536.dmp
[16:25:40] Dump 1 complete: 153 MB written in 3.4
seconds
[16:25:42] CPU: 75% 1s
[16:25:43] CPU: 74% 2s
[16:25:44] CPU: 80% 3s (Trigger)
[16:25:44] Dump 2 initiated: C:\Documents and
Settings\Administrator\w3wp.exe_16
0110_162544.dmp
[16:25:44] Dump 2 complete: 173 MB written in 0.4
seconds
[16:25:45] Dump count reached.
C:\Documents and
Settings\Administrator>iisapp
W3WP.exe PID: 18008 AppPoolId: STAT
W3WP.exe PID: 8328 AppPoolId: STAT
W3WP.exe PID: 17868 AppPoolId: JYCV16
W3WP.exe PID: 16652 AppPoolId: JYCONLINE
W3WP.exe PID: 1248 AppPoolId: MAIL
W3WP.exe PID: 11948 AppPoolId: TOPWOM
W3WP.exe PID: 6268 AppPoolId: jvm
C:\Documents and Settings\Administrator>
2.用WiinDbg打开dump文件(File
\ Open Crash Dump)
3.输入命令!analyze
-v,等待几秒后会打印出错误信息,函数调用栈如下图:
参考方法:
我们经常遇到w3wp.exe进程的CPU占用率在某一时间段内突然升高几倍,但是无论使用adplus.vbs还是debug
dialog去抓取这一瞬间的dump都是有难度的。而且遇到高cpu的问题我们通常抓取一个dump不能看出问题,需要多个样例。
就能够很好的处理这个情况:
procdump -ma -c 50
-s 3 -n 2 5844(Process Name or PID)-ma将整个进程的内存信息写入dump。默认包含thread和handle信息-c在CPU到达多少的时候抓取-s持续多少秒后抓取 (default is
10).
-n抓几次-6464bit的w3wp.exe要用这个-e 当进程遇到unhandled
exception的时候-r Server 2008 R2支持的,clone一个process来做dump,减少因为抓dump而使w3wp挂起的时间
0:121:x86> ~108s
The wow64exts extension must be loaded to access 32-bit
state.
.load wow64exts will do this if you haven't loaded it
already.
ntdll!ZwQueryVirtualMemory+0xa:
0033:77b6154a
0:108:x86> ~121s
clr!CoInitializeEE+0x47df2:
74216664 81f904000080 cmp
ecx,80000004h
0:121:x86> k