iostat -x 1 查看磁盤的IO負載



Linux系統出現了性能問題。一般我們能夠通過top.iostat,vmstat等命令來查看初步定位問題。當中iostat能夠給我們提供豐富的IO狀態數據

$ iostat -x -1 

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

          10.43    0.00    1.51    1.51    0.00   86.56

Device:rrqm/s  wrqm/s  r/s   w/s  rkB/s  wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util

sda 4477.00   9.00  951.00  13.00 24288.00 2492.00 55.56   0.21    0.22    0.21    0.92   0.17  16.00


%user :Show the percentage  of  CPU  utilization  that  occurred while executing at the user level (application).

%nice  :Show  the  percentage  of  CPU  utilization that occurred while executing at the user level with nice priority.                

%system: Show the percentage  of  CPU  utilization  that  occurred  while executing at the system level (kernel).

%iowait:Show  the  percentage  of  time that the CPU or CPUs were  idle during which the system had an outstanding disk  I/O  request.      

%steal :Show  the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was  servicing another virtual processor.                  

%idle :Show  the  percentage  of  time that the CPU or CPUs were idle and the system did not have an outstanding disk  I/O   request.   

                 

rrqm/s:每秒進行merge的讀操作數目。即delta(rmerge)/s 
wrqm/s:每秒進行merge的寫操作數目。

即delta(wmerge)/s 

r/s:每秒完畢的讀I/O設備次數。

即delta(rio)/s 

w/s:每秒完畢的寫I/0設備次數。即delta(wio)/s 
rsec/s:每秒讀扇區數。即delta(rsect)/s 
wsec/s:每秒寫扇區數。即delta(wsect)/s 
rKB/s:每秒讀K字節數。是rsec/s的一半,由於每扇區大小為512字節 
wKB/s:每秒寫K字節數。是wsec/s的一半 
avgrq-sz:平均每次設備I/O操作的數據大小(扇區)。即delta(rsect+wsect)/delta(rio+wio) 
avgqu-sz:平均I/O隊列長度。即delta(aveq)/s/1000(由於aveq的單位為毫秒) 
await:平均每次設備I/O操作的等待時間(毫秒)。即delta(ruse+wuse)/delta(rio+wio) 
svctm:平均每次設備I/O操作的服務時間(毫秒)。即delta(use)/delta(rio+wio) 
%util:一秒中有百分之多少的時間用於I/O操作,或者說一秒中有多少時間I/O隊列是非空的。即delta(usr)/s/1000(由於use的單位為毫秒) 

假設%util接近100%,表明I/O請求太多,I/O系統已經滿負荷,磁盤可能存在瓶頸,一般%util大於70%,I/O壓力就比較大.

svctm一般要小於await(由於同一時候等待的請求的等待時間被反復計算了),svctm的大小一般和磁盤性能有關,CPU/內存的負荷也會對其有影響,請求過多也會 間接導致svctm的添加。

await的大小一般取決於服務時間(svctm)以及I/O隊列的長度和I/O請求的發出模式。假設svctm比較接近await,說明I/O差點兒沒有等待時間;假設await遠大於svctm,說明I/O隊列太長。應用得到的響應時間變慢,假設響應時間超過了用戶能夠容許的范圍,這時能夠考慮更換更快的磁盤,調整內核elevator算法,優化應用,或者升級CPU 


隊列長度(avcqu-sz)也可作為衡量系統I/O負荷的指標,但因為avcqu-sz是依照單位時間的平均值,所以不能反映瞬間的I/O洪水。



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM