Home | Mirror | Search

5. Harddisk IO

5.1. input/output statistics

$ sudo apt-get install sysstat
		

iostat

$ iostat
Linux 2.6.24-21-generic (netkiller)     Thursday, December 04, 2008

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.57    0.03    0.14    0.41    0.00   98.85

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               6.45       132.69        68.33     595116     306456
sda1              0.00         0.00         0.00       1606         58
sda2              0.00         0.00         0.00        820          0
sda3              2.20         1.16        17.27    1502618   22448752
		

sudo iostat -x 2

# iostat -x 1
avg-cpu: %user %nice %sys %idle
2.04 0.00 97.96 0.00
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
/dev/sda 0.00 633.67 3.06 102.31 24.49 5281.63 12.24 2640.82 288.89 73.67 113.89 27.22 50.00

從輸出我們看到w/s=102,wKB/s=2640.所以2640/102=23KB per I/O.

因此對於連續I/O系統來說我們要關注系統讀取大量數據的能力即KB per request.對於隨機I/O系統我們注重IOPS值.
		

5.1.1. 5 秒監控一次

iostat -d 5
			

5.2. iotop - simple top-like I/O monitor

# yum install iotop
	    
$ sudo apt-get install iotop
	    

5.3. ionice - set or get process I/O scheduling class and priority

comments powered by Disqus