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


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

$ iostat -x -1 

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

          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  %utilapp

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.00post


%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.      spa

%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 it

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洪水。
相關文章
相關標籤/搜索