IIS 8.0 (Windows Server 2012) 重寫 CPU 節流機制,從舊版「輪詢檢查 + 超限殺進程」升級為「內核級硬限制 + 智能模式」,實現零停機、平滑限流。本文深度解析架構差異、配置參數與選型指南。
| 模式 | 配置鍵 | 行為 | 適用場景 |
|---|---|---|---|
| Throttle (硬限制) | cpuLimit + cpuLimitAction="Throttle" | 全時段強制限制 CPU 不超過上限 (如 25%),閒時也不放寬 | 多租戶共享主機、嚴格 SLA、合規要求硬隔離 |
| ThrottleUnderLoad (智能限制) | cpuLimit + cpuLimitAction="ThrottleUnderLoad" | 系統繁忙時限制上限;系統閒置時允許突發使用更多 CPU (搶佔空閒週期) | 獨享/彈性業務、夜間批次任務、開發測試環境 |
<system.applicationHost>
<applicationPools>
<add name="TenantA_Pool" managedRuntimeVersion="v4.0">
<cpu limit="25000" action="Throttle" /> <!-- 25% 硬限制 -->
</add>
<add name="Batch_Pool" managedRuntimeVersion="v4.0">
<cpu limit="50000" action="ThrottleUnderLoad" /> <!-- 50% 智能限制 -->
</add>
</applicationPools>
</system.applicationHost>
limit 单位:1/1000% (25000 = 25%),范圍 0-100000。action 可選: Throttle | ThrottleUnderLoad | KillW3wp (兼容舊版行為)。Web Service Cache\Current CPU Usage % / Process(w3wp)\% Processor Time。KillW3wp,除非極端兼容舊邏輯無法改造。IIS 8.0 CPU 節流從「事後殺進程」進化為「事前控排程」,以內核級硬實力重新定義共享主機資源治理標準。