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