PowerFlex:CPU 概念和故障診斷
Summary: 有些人可能不知道 CPU 概念和基本故障診斷,或讓他們對此感到困惑。 此 KB 提供 CPU 相關資訊和故障診斷方法。
Instructions
概念說明
-
中央處理器 (CPU) - CPU 是執行電腦程式指令的硬體。
它會執行電腦系統的基本算術、邏輯和輸入/輸出操作。
通常顯示為處理器或插槽 -
CPU 核心 - CPU 核心是實際的 CPU 處理元件。
它可處理從執行緒接收的所有命令順序。
也稱為 pCPU (VMware) -
CPU 執行緒 - CPU 執行緒是 CPU 核心的虛擬版本。
執行緒只是指令的有序順序。 -
邏輯核心 - 每個 CPU 執行緒會直接與邏輯核心比較。邏輯核心測量實體核心可以同時運行的作業數目。
使用超執行緒功能,一個實體核心可以執行兩個作業,因此具有兩個邏輯核心。 -
超執行緒 - 這是 CPU 會將其每個實體核心分割成虛擬核心的過程,這些稱為執行緒。
可在支援它的作業系統 (OS) 和 BIOS 上啟用/停用。 -
虛擬中央處理器 (vCPU) - 虛擬機器 (VM) 作業系統會將每個 vCPU 視為單一實體 CPU 核心。
代表指派給 VM 的實體核心其中一部分或共用
視 Hypervisor 而定,每個實體核心依每個 VM 支援 5-10 個 vCPU。
CPU > 核心 > vCPU 圖表
實體核心與邏輯核心lscpu 命令輸出
lscpu | egrep 'Socket\(s\)|Core\(s\) per socket|Thread\(s\) per core|CPU\(s\)\:' | tac
範例輸出:
Socket(s): 2 ← The motherboard has 2 CPU processors/sockets. Core(s) per socket: 8 ← Each CPU socket has 8 physical cores. Hence, it has 16 physical cores in total. Thread(s) per core: 2 ← Each physical CPU core can run 2 threads = Hyper-Threading enabled. CPU(s): 32 ← The computer has 2 × 8 × 2 = 32 logical cores in total.
邏輯核心的總索引 = CPU 插槽 × 每個插槽的實體核心 × 每個實體核心的執行緒。
/proc/cpuinfo 檔案輸出
echo " "; echo "Model Name: "$(cat /proc/cpuinfo|egrep 'model name'|head -1|awk '{for(i=4;i<=20;i++)printf "%s ",$i;print ""}'); cat /proc/cpuinfo | egrep 'processor|physical id|siblings|core id|cpu cores' | sed "s/^processor/\n&/"
範例輸出:
所有輸出值均以零為基礎。
processor : 0 ← The index number of threads. physical id : 0 ← CPU socket index #0 (the only one if no other physical id's in the full output). siblings : 8 ← The amount of logical cores in the socket. core id : 0 ← CPU core index #0. cpu cores : 4 ← CPU socket index #0 has 4 physical cores.
邏輯核心總數 = 同層級 × 實體 ID 總數
PowerFlex 說明文件和記錄
若要尋找 PowerFlex 伺服器的 CPU 相關資訊,您可以使用下列方法:
只在即時系統上lscpu
echo " ";echo "Model Name: "$(lscpu|egrep 'Model name'|awk '{for(i=4;i<=20;i++)printf "%s ",$i;print ""}');echo " ";lscpu|egrep 'Socket\(s\)|Core\(s\) per socket|Thread\(s\) per core|CPU\(s\)\:'|tac
範例輸出:
Model name: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz Socket(s): 1 Core(s) per socket: 4 Thread(s) per core: 2 CPU(s): 8
在即時系統上「且」getInfoDump
/proc/cpuinfo
echo " ";echo "Model Name: "$(cat /proc/cpuinfo|egrep 'model name'|head -1|awk '{for(i=4;i<=20;i++)printf "%s ",$i;print ""}');cat /proc/cpuinfo|egrep 'processor|physical id|siblings|core id|cpu cores'|sed "s/^processor/\n&/"
若為 getInfoDump,您必須變更 cpuinfo 檔案位置,其位於 ...\getInfoDump\server\proc_cpuinfo.txt 下。
此 /proc/cpuinfo 檔案比 更完整 lscpu - 如需其他資訊,請使用以下連結。
範例輸出:
Model Name: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz processor : 0 physical id : 0 siblings : 8 core id : 0 cpu cores : 4 processor : 1 physical id : 0 siblings : 8 core id : 0 cpu cores : 4 processor : 2 physical id : 0 siblings : 8 core id : 1 cpu cores : 4 processor : 3 physical id : 0 siblings : 8 core id : 1 cpu cores : 4 processor : 4 physical id : 0 siblings : 8 core id : 2 cpu cores : 4 processor : 5 physical id : 0 siblings : 8 core id : 2 cpu cores : 4 processor : 6 physical id : 0 siblings : 8 core id : 3 cpu cores : 4 processor : 7 physical id : 0 siblings : 8 core id : 3 cpu cores : 4
如需 PowerFlex 系統需求和建議,請參閱 Dell 支援網站上的官方說明文件。
故障診斷工具與秘訣
Linuxtop
此工具可提供使用者、工作、CPU 負載和記憶體使用的讀出。
若要退出上方功能,請按下鍵盤上的字母「q」。
部分標準命令切換值:-i
Idle-processes
這會隱藏所有閒置程序,以更輕鬆地對瀏覽清單。
-n
Number-of-iterations
指定上方在結束之前應產生的迭代或訊框最大數目。
-b
Batch-mode
以批次模式從上方開始,這對於將輸出從上方傳送到其他程式或檔案可能很有用。
-n' 切換值選項或直到終止。
上方在執行中時,其他一些有用的命令包括:M - 按記憶體使用對工作清單進行排序P - 按處理器使用對工作清單進行排序N - 按程序 ID 對工作清單進行排序T - 按執行時間對工作清單進行排序
mpstat
此工具是軟體套裝的一部分,稱為 sysstat,其中會顯示 CPU 活動。系統會顯示每個處理器 (或處理器核心) 的使用。
%usr – % CPU usage at the user level. %nice – % CPU usage for user processes labeled “nice”. %sys – % CPU usage at the system (Linux kernel) level. %iowait – % CPU usage idling waiting on a disk read/write. %irq – % CPU usage handling hardware interrupts. %soft – % CPU usage handing software interrupts. %steal – % CPU usage being forced to wait for a hypervisor handling other virtual processors. %guest – % CPU usage spent running a virtual processor. %idle – % CPU usage on idle time (no processes, and not waiting on a disk read/write).
iostat
平均使用的命令。系統會顯示自上次開機以來的平均 CPU 使用。
sar
此工具可管理系統資源。
常用命令切換值:-u
這只會追蹤 CPU 效能
%user: Percentage of CPU utilization that occurred while executing at the user level (application). %nice: Percentage of CPU utilization that occurred while executing at the user level with nice priority. %system: Percentage of CPU utilization that occurred while executing at the system level (kernel). %iowait: Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request. %idle: Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.
下列命令會顯示 Linux 系統上前 10 名的 CPU 使用者:
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
或
ps -eo pcpu,pid,user,args | sort -r -k1 | less
VMware
在虛擬化環境中,尤其是常用的 VMware ESXi 中,系統資源會分層使用,有時會過於全面而無法快速分析。
請依照此 VMware KB 取得各種代碼版本,以故障診斷 ESXi 主機/VM 效能問題 - 故障診斷 VMware 資源。
UI 和 CLI 都可用來故障診斷 CPU 和其他資源的效能。
UI:
vCenter Server 會從所有已連線的 ESXi 主機和 VM 收集統計資料,並按設定的間隔進行資料彙總、計算和歸檔。
若要存取資料,請啟動 vSphere Client,選取您的 VM 或主機,然後前往監控 > 效能 > 概觀,以取得主要指標的摘要,例如 CPU、記憶體、磁碟和網路。
前往「進階」並使用右上角的「檢視」下拉式功能表,檢視每個指標的更多詳細資料。
CLI:esxtop
此工具可提供使用者、工作、CPU 負載和記憶體使用的讀出。
登入主機 SSH 工作階段 (需要根權限),然後輸入 esxtop。啟動 ESXTOP 時,預設情況下會顯示 CPU 檢視。
如需更全面瞭解各種 esxtop 指標和畫面,請參閱下列文章 - ESXTOP 說明。
請注意,對於 VM 上特定的 OS/應用程式效能,請遵循相關供應商為每個 OS/應用程式提供的相關說明。
部分標準命令切換值:-l
在大型環境中,由於必須收集的資料量和必須完成的計算量,esxtop 的 CPU 利用率可能會很高。
鎖定特定實體並防止 esxtop 收集詳細資訊,以限制所需的 CPU 功率量。
-l' 時,實體已被鎖定!
-u
此選項會抑制伺服器的實體 CPU 統計資料,可節省大量資料儲存。
-n
Number-of-iterations
指定 esxtop 在結束之前應產生的迭代或訊框最大數目。
-b
Batch-mode
以批次模式從上方開始,這對於將輸出從上方傳送到其他程式或檔案可能很有用。
-b' 時,實體已被鎖定!此外,在此模式下,esxtop 不會接受輸入並會繼續執行,直到迭代限制設定了 '-n' 切換值選項或直到終止。
Windows
在 Windows 環境中,CPU 和記憶體的高使用率並不總是必須修正的問題。這會依使用案例而有所不同。
我們可以使用工作管理員,並查看哪個應用程式/工作/服務會導致高資源使用。
由於 Windows Server 可用於各種目的,執行多個服務。
請遵循此 Microsoft KB 以針對各種服務的效能問題進行故障診斷 - 故障診斷 Windows Server 元件。
PowerShell
跨平台工作自動化和組態管理框架,包含命令列 shell 和指令碼式語言
請參閱下列文章,以更全面地瞭解使用 PowerShell 進行 CPU 故障診斷 - PowerShell CPU 故障診斷。