簡介
本文說明如何閱讀4300系列整合多業務路由器(ISR)上的中央處理器(CPU)使用情況。
必要條件
需求
思科建議您瞭解以下主題:
採用元件
本檔案中的資訊是根據硬體和軟體版本:
- ISR4321/K9
- ISR4331/K9
- ISR4351/K9
- 03.16.01a.S // 15.5(3)S1a
- 03.16.04b.S // 15.5(3)S4b
- 16.9.7
- 16.12.4
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
架構
Cisco ISR 4000系列平台運行Cisco IOS XE,它具有分散式軟體架構,該架構運行Linux核心,其中Cisco IOS®作為多個Linux進程之一運行。 Cisco IOS作為守護程式運行,稱為Cisco IOS守護程式(IOSd)。
Cisco IOSd上的CPU使用情況
要監控IOSd上的CPU使用情況,請運行show process cpu命令:
#show process cpu
CPU utilization for five seconds: 1%/0%; one minute: 1%; five minutes: 0%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
1 2 8 250 0.00% 0.00% 0.00% 0 Chunk Manager
2 5 18 277 0.07% 0.00% 0.00% 0 Load Meter
3 0 2 0 0.00% 0.00% 0.00% 0 DiagCard4/-1
4 0 1 0 0.00% 0.00% 0.00% 0 Retransmission o
5 0 1 0 0.00% 0.00% 0.00% 0 IPC ISSU Dispatc
輸出顯示兩個CPU使用率值,第一個值是CPU的總使用率,第二個值是傳送到IOSd的中斷造成的CPU使用率:
CPU總量與中斷造成的CPU總量之間的差異是進程消耗的CPU值;為了證實增加過去五秒內所有進程使用情況:
- 進程的CPU消耗= 1% - 0% = 1% =命令上列出的所有進程CPU消耗
要顯示佔用最多CPU的進程,請運行show process cpu sorted命令:
#show process cpu sorted
CPU utilization for five seconds: 1%/0%; one minute: 0%; five minutes: 0%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
64 103 10 10300 0.33% 0.02% 0.00% 0 Licensing Auto U
83 26 231 112 0.27% 0.00% 0.00% 0 PuntInject Keepa
235 555 48176 11 0.11% 0.09% 0.07% 0 Inline Power
1 2 8 250 0.00% 0.00% 0.00% 0 Chunk Manager
注意:所有處理序的相加都會產生浮點值,IOSd會將結果四捨五入為下一個整數。
流量的CPU使用率
為了轉發流量,ISR4300系列設計透過一個稱為QuantumFlow處理器(QFP)的元素。
注意:在ASR1K上可發現QFP是一個或多個物理晶片,在ISR4400上,使用Cavium Octeon協處理器可完成相同功能,在ISR4300上,可在主Intel CPU的特定核心上完成相同功能。您可以將ISR4300系列上的QFP視為轉發資料包的軟體。
要確定資料流消耗的CPU量,您可以運行show platform hardware qfp active datapath utilization命令:
#show platform hardware qfp active datapath utilization
CPP 0: Subdev 0 5 secs 1 min 5 min 60 min
Input: Priority (pps) 0 0 0 0
(bps) 0 0 0 0
Non-Priority (pps) 3 2 2 1
(bps) 1448 992 992 568
Total (pps) 3 2 2 1
(bps) 1448 992 992 568
Output: Priority (pps) 0 0 0 0
(bps) 0 0 0 0
Non-Priority (pps) 3 2 2 1
(bps) 12216 8024 8024 4576
Total (pps) 3 2 2 1
(bps) 12216 8024 8024 4576
Processing: Load (pct) 0 0 0 1
該命令列出優先順序和非優先順序資料包的輸入和輸出CPU使用情況,資訊以每秒資料包(PPS)和每秒位數(BPS)顯示,最後一行顯示由於資料包轉發導致的CPU負載總量(百分比[PCT]值)。
安裝的CPU核心
ISR4300系列安裝了不同數量的CPU核心,這取決於型號;要確定您的裝置上安裝的核心數,請運行show processes cpu platform命令:
#show processes cpu platform
CPU utilization for five seconds: 30%, one minute: 29%, five minutes: 29%
Core 0: CPU utilization for five seconds: 13%, one minute: 13%, five minutes: 13%
Core 1: CPU utilization for five seconds: 2%, one minute: 3%, five minutes: 3%
Core 2: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 3: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99%
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
1 0 0% 0% 0% S 1863680 init
2 0 0% 0% 0% S 0 kthreadd
或者,運行show platform software status control-processor命令:
#show platform software status control-processor
<output omitted>
Per-core Statistics
CPU0: CPU Utilization (percentage of time spent)
User: 4.80, System: 10.30, Nice: 0.00, Idle: 84.50
IRQ: 0.40, SIRQ: 0.00, IOwait: 0.00
CPU1: CPU Utilization (percentage of time spent)
User: 2.00, System: 3.40, Nice: 0.00, Idle: 94.59
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
CPU2: CPU Utilization (percentage of time spent)
User: 0.50, System: 0.00, Nice: 0.00, Idle: 99.49
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
CPU3: CPU Utilization (percentage of time spent)
User: 24.72, System: 75.27, Nice: 0.00, Idle: 0.00
IRQ: 0.00, SIRQ: 0.00, IOwait: 0.00
另一方面,運行show platform software status control-processor brief命令,以下任何命令都會顯示安裝的核心數量:
#show platform software status control-processor brief
<output omitted>
CPU Utilization
Slot CPU User System Nice Idle IRQ SIRQ IOwait
RP0 0 4.30 9.80 0.00 85.90 0.00 0.00 0.00
1 0.79 0.99 0.00 98.20 0.00 0.00 0.00
2 0.50 0.00 0.00 99.50 0.00 0.00 0.00
3 24.60 75.40 0.00 0.00 0.00 0.00 0.00
CPU核心分佈
ISR4300系列的設計產生了用於資料包處理的特定核心。4到7個核心保留用於ISR4331和4351上的資料包處理,2到3個核心用於ISR4321。
在由於效能原因而包括Cisco IOS XE版本16.5.x之前,分層隊列架構(HQF)具有執行緒總是熱旋轉和高CPU使用率運行的特點,無論機箱上有何種配置,也不管透過系統的流量有多大。在ISR4300平台上,由於QFP軟體在主CPU上運行,因此在一個或多個核心上,CPU使用率可能很高。
但是,在包括Cisco IOS XE版本16.6.x後,實施了一個更改,以便這些平台不會使執行緒產生熱旋轉。在這種情況下,CPU使用率會透過核心進行更多分配。
要顯示熱旋轉使用情況,請運行show processes cpu platform sorted命令,位於Cisco IOS XE 16.6.x之前:
#show processes cpu platform sorted
CPU utilization for five seconds: 28%, one minute: 29%, five minutes: 29%
Core 0: CPU utilization for five seconds: 12%, one minute: 13%, five minutes: 14%
Core 1: CPU utilization for five seconds: 2%, one minute: 3%, five minutes: 3%
Core 2: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 3: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99% <<< hot-spin
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
2541 1955 99% 99% 99% S 1073807360 qfp-ucode-utah <<< high CPU process
1551 929 7% 7% 7% S 2038525952 fman_fp_image
在八核心架構上,Cisco IOS XE 16.6.x之前的版本,如果採用不同的核心進行熱旋轉,您會看到相同的結果:
#show processes cpu platform sorted
CPU utilization for five seconds: 15%, one minute: 14%, five minutes: 15%
Core 0: CPU utilization for five seconds: 6%, one minute: 4%, five minutes: 8%
Core 1: CPU utilization for five seconds: 1%, one minute: 0%, five minutes: 2%
Core 2: CPU utilization for five seconds: 9%, one minute: 10%, five minutes: 7%
Core 3: CPU utilization for five seconds: 1%, one minute: 2%, five minutes: 1%
Core 4: CPU utilization for five seconds: 1%, one minute: 1%, five minutes: 1%
Core 5: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Core 6: CPU utilization for five seconds: 99%, one minute: 99%, five minutes: 99% <<< hot-spin
Core 7: CPU utilization for five seconds: 0%, one minute: 0%, five minutes: 0%
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
3432 2779 99% 99% 99% S 1086341120 qfp-ucode-utah <<< high CPU process
2612 1893 7% 7% 7% S 2038697984 fman_fp_image
26114 25132 4% 5% 5% R 42803200 hman
增加和增加Cisco IOS XE 16.6.x之後,您可以看到核心2和核心3之間的負載分佈:
------------------ show process cpu platform sorted ------------------
CPU utilization for five seconds: 31%, one minute: 32%, five minutes: 29%
Core 0: CPU utilization for five seconds: 3%, one minute: 3%, five minutes: 3%
Core 1: CPU utilization for five seconds: 3%, one minute: 2%, five minutes: 2%
Core 2: CPU utilization for five seconds: 39%, one minute: 41%, five minutes: 34% <<< load distributed
Core 3: CPU utilization for five seconds: 84%, one minute: 83%, five minutes: 79% <<< load distributed
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
26939 26344 127% 126% 116% S 1195311104 qfp-ucode-utah <<< high CPU process
在增加並包括Cisco IOS XE 16.6.x後,上述輸出同樣適用,但適用於核心4到7:
------------------ show process cpu platform sorted ------------------
CPU utilization for five seconds: 30%, one minute: 24%, five minutes: 27%
Core 0: CPU utilization for five seconds: 41%, one minute: 13%, five minutes: 13%
Core 1: CPU utilization for five seconds: 23%, one minute: 11%, five minutes: 13%
Core 2: CPU utilization for five seconds: 19%, one minute: 10%, five minutes: 12%
Core 3: CPU utilization for five seconds: 38%, one minute: 12%, five minutes: 12%
Core 4: CPU utilization for five seconds: 28%, one minute: 26%, five minutes: 28% <<< load distributed
Core 5: CPU utilization for five seconds: 53%, one minute: 40%, five minutes: 37% <<< load distributed
Core 6: CPU utilization for five seconds: 18%, one minute: 16%, five minutes: 17% <<< load distributed
Core 7: CPU utilization for five seconds: 93%, one minute: 81%, five minutes: 81% <<< load distributed
Pid PPid 5Sec 1Min 5Min Status Size Name
--------------------------------------------------------------------------------
26049 25462 164% 165% 170% S 394128 qfp-ucode-utah <<< high CPU process
注意:如果懷疑核心CPU使用率有問題,請提出技術支援中心(TAC)支援請求以獲得幫助並確認裝置穩定性。
監控CPU的最佳做法
最好使用特定命令來進行資料路徑利用率或IOSd使用,核心顯示命令的結果可能導致誤報警報。
用於監控資料路徑利用率的命令為:
- show platform hardware qfp active datapath utilization
用於監控IOSd使用情況的命令是:
使用下列物件辨識碼(OID)中的任一個,透過簡易網路管理通訊協定(SNMP)來監控IOSd CPU使用狀況: