最近兩天監控到站點使用CPU過高,考慮在4核的伺服器上限定站點最多使用3個核,即限定站點的最高CPU使用率為75%;
(1)使用計劃任務定期執行以下powershell腳本;
1
2
3
4
5
6
7
8
9
10
11
<code><# </code>
<code>Script's function: set affinity of w3wp.exe to CPU1,CPU2,CPU3 </code>
<code>Script Editor: Snail </code>
<code>Date: 2014-08-08 </code>
<code>Refer to Website: </code>
<code>http://technet.microsoft.com/zh-cn/subscriptions/index/system.diagnostics.process.processoraffinity </code>
<code>http://waynes-world-it.blogspot.com/2009/06/processor-affinity-on-windows-server.html #></code>
<code>$w3wps</code><code>=</code><code>get-process</code> <code>-processname </code><code>"w3wp"</code>
<code>foreach</code> <code>(</code><code>$w3wp</code> <code>in</code> <code>$w3wps</code><code>) { </code>
<code> </code><code>$w3wp</code><code>.ProcessorAffinity = 0x0E </code>
<code>}</code>
(2)手動操作指定;(此方法有一定時效性,需每天手動操作一次,屬臨時性;)
1.打開資料總管,找到需要限定的站點;右擊,選擇“Set Affinity…”
<a href="http://281816327.blog.51cto.com/attachment/201408/8/907015_14074676562jDS.png" target="_blank"></a>
2.勾選指定的CPU,點選OK即可;
<a href="http://281816327.blog.51cto.com/attachment/201408/8/907015_1407467657xK8h.png" target="_blank"></a>
(3)使用WSRM限定;(不推薦使用,wsrm功能在server 2012後已經取消,由hyper-v部分功能代替)
<b>本文轉自 bannerpei 51CTO部落格,原文連結:http://blog.51cto.com/281816327/1537320,如需轉載請自行聯系原作者</b>