Linux常用命令及詳細(xì)說明 — 結(jié)合工作(側(cè)重性能監(jiān)控,包括CPU、內(nèi)存、IO、網(wǎng)絡(luò)、磁盤等)
命令
功能
命令
功能
iostat
統(tǒng)計CPU及網(wǎng)絡(luò)、設(shè)備和分區(qū)IO的數(shù)據(jù)
vmstat
展示給定時間服務(wù)器的狀態(tài)值(包括CPU使用率、內(nèi)存使用狀況、虛擬內(nèi)存交換情況、IO讀寫情況),很常用
顯示內(nèi)存狀況,包括空閑以及被使用的物理內(nèi)存、交換內(nèi)存以及被kernel使用的緩沖區(qū)
System Activity report 系統(tǒng)活動報告,是目前Linux最為全面的系統(tǒng)性能分析工具之一
顯示當(dāng)前正在運行的所有進程的快照
strace
跟蹤進程執(zhí)行時系統(tǒng)調(diào)和所接收的信號
實時顯示系統(tǒng)中各個進程的資源(cpu和load)占用狀況,類似于windows任務(wù)管理器
tcpdump
dump the traffic on a network, 根據(jù)用戶定義對網(wǎng)絡(luò)上的包進行截獲的包分析工具,
功能和查看pcap包的wireshark工具差不多
統(tǒng)計CPU及網(wǎng)絡(luò)、設(shè)備和分區(qū)IO的數(shù)據(jù),具體命令行參數(shù)見下表:
選項
含義
顯示設(shè)備(磁盤)使用狀態(tài)
某些使用block為單位的列強制使用kilobytes/每秒
顯示更多統(tǒng)計信息
顯示CPU利用率
輸入"iostat -x”,結(jié)果如下圖:
avg-cpu統(tǒng)計信息每段含義見下表:
參數(shù)
含義
%user
在用戶態(tài)運行程序,CPU利用的百分比
%nice
在nice優(yōu)先級(即靜態(tài)優(yōu)先級,具體啥含義請百度)
%system
在內(nèi)核態(tài)運行程序,CPU利用的百分比
特別重要 —show the percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request
% time this is the percentage of the `total' time that was spent。this connection time only includes time spent for the rd connection broker server, and doesn’t include the time to prepare the virtual machine and client to eventually connect to it after redirection.。"time flies.time and tides wait for no men".you can see how important time is.lunxun had said"i spent the time on my work while others are havig coffee."we must make good use of our time,especially for our students,we shouldn&rsquo。
while the hypervisor was servicing another virtual processor
%idle
CPU 空閑的比列,CPU沒有IO請求需要處理 — 和 %iowait含義相反
設(shè)備(device)輸出結(jié)果每段含義詳細(xì)說明見下表:
參數(shù)
含義
rrqm/s
每秒這個設(shè)備相關(guān)的讀取請求有多少被merge了,
當(dāng)系統(tǒng)調(diào)用需要讀取數(shù)據(jù)的時候,VFS將請求發(fā)到各個FS,如果FS發(fā)現(xiàn)不同的讀取請求讀取的是相同Block的數(shù)據(jù),F(xiàn)S會將這個請求合并Merge