用iostat和vmstat监控磁盘性能

vmstat

vmstat提供的数据是基于系统启动后到目前计算的,无法给出当前io运行的统计数据

 

Options

 

Option

Explanation

-D

This displays Linux I/O subsystem total statistics. This option can give you a good idea of how your I/O subsystem is being used, but it won't give statistics on individual disks. The statistics given are the totals since system boot, rather than just those that occurred between this sample and the previous sample.

-d

This option displays individual disk statistics at a rate of one sample per interval . The statistics are the totals since system boot, rather than just those that occurred between this sample and the previous sample.

-p partition

This displays performance statistics about the given partition at a rate of one sample per interval . The statistics are the totals since system boot, rather than just those that occurred between this sample and the previous sample.

interval

The length of time between samples.

count

The total number of samples to take.

 

 

Result Fields:

 

Table 6-3. vmstat Disk I/O Statistics

Statistic

Explanation

disks

The total number of disks in the system.

partitions

The total number of partitions in the system.

total reads

The total number of reads that have been requested.

merged reads

The total number of times that different reads to adjacent locations on the disk were merged to improve performance.

read sectors

The total number of sectors read from disk. (A sector is usually 512 bytes.)

milli reading

The amount of time (in ms) spent reading from the disk.

writes

The total number of writes that have been requested.

merged writes

The total number of times that different writes to adjacent locations on the disk were merged to improve performance.

written sectors

The total number of sectors written to disk. (A sector is usually 512 bytes.)

milli writing

The amount of time (in ms) spent writing to the disk.

inprogress IO

The total number of I/O that are currently in progress. Note that there is a bug in recent versions (v3.2) of vmstat in which this is incorrectly divided by 1,000, which almost always yields a 0.

milli spent IO

This is the number of milliseconds spent waiting for I/O to complete. Note that there is a bug in recent versions (v3.2) of vmstat in which this is the number of seconds spent on I/O rather than milliseconds.

 

Examples

显示IO子系统的整体情况,自从系统启动以后

 

vmstat -D

显示每个磁盘的统计信息, 间隔1s,运行3次

vmstat -d 1 3
 

iostat

iostat可以给出当前运行期间,IO系统的统计信息。

 

下面连个选项比较重要

await  在磁盘队列中的等待时间加上完成磁盘读写的平均时间

svctm  完成磁盘读写的平均时间。相当于 await - 等待时间

 

Fields in Result

Table 6-8. iostat Extended Disk Statistics

Statistic

Explanation

rrqm/s

The number of reads merged before they were issued to the disk.

wrqm/s

The number of writes merged before they were issued to the disk.

r/s

The number of reads issued to the disk per second.

w/s

The number of writes issued to the disk per second.

rsec/s

Disk sectors read per second.

wsec/s

Disk sectors written per second.

rkB/s

Kilobytes read from disk per second.

wkB/s

Kilobytes written to disk per second.

avgrq-sz

The average size (in sectors) of disk requests.

avgqu-sz

The average size of the disk request queue.

await

The average time (in ms) for a request to be completely serviced. This average includes the time that the request was waiting in the disk's queue plus the amount of time it was serviced by the disk.

svctm

The average service time (in ms) for requests submitted to the disk. This indicates how long on average the disk took to complete a request. Unlike await , it does not include the amount of time spent waiting in the queue.

 

Examples

显示基本统计信息

[root@Load1-002 ~]# iostat -d 1 2 
Linux 2.6.29.6-0.6.smp.gcc4.1.x86_64 (Load1-002) 	11/11/2009

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              69.42         4.91       900.22     935378  171491852
sda1              0.00         0.01         0.00       1912          4
sda2              0.06         1.25        11.06     237784    2106272
sda3             69.36         3.65       889.16     694914  169385576
sdb               0.92         1.25        36.54     237644    6960632
sdb1              0.92         1.24        36.54     236996    6960632
sdc               0.75         0.29        31.33      55204    5968600
sdc1              0.75         0.29        31.33      54556    5968600
sdd               0.73         0.28        29.44      53060    5607992
sdd1              0.73         0.27        29.44      52268    5607992
sde               0.41         0.15         8.61      28996    1639864
sde1              0.41         0.15         8.61      28204    1639864
sdf               0.42         0.14         8.80      27364    1676472
sdf1              0.42         0.14         8.80      26716    1676472
sdg               0.40         0.12         8.51      23388    1620560
sdg1              0.40         0.12         8.51      22740    1620560
sdh               0.40         0.15         8.46      29180    1611384
sdh1              0.40         0.15         8.46      28532    1611384
sdi              19.28         0.68       388.69     128892   74045568
sdi1             19.28         0.67       388.69     128244   74045568
sdj               0.41         0.15         8.56      28068    1629848
sdj1              0.41         0.14         8.56      27276    1629848
sdk               1.72         0.15        66.90      29356   12744208
sdk1              1.72         0.15        66.90      28708   12744208
sdl               0.42         0.12         8.88      23324    1691472
sdl1              0.42         0.12         8.88      22676    1691472
sdm               0.42         0.14         8.87      27476    1689304
sdm1              0.42         0.14         8.87      26828    1689304
sdn               0.41         0.15         8.63      28196    1644344
sdn1              0.41         0.14         8.63      27548    1644344
sdo               0.42         0.14         8.92      27164    1699496
sdo1              0.42         0.14         8.92      26516    1699496
sdp               0.42         0.15         8.74      28516    1665752
sdp1              0.42         0.15         8.74      27868    1665752


... ...
 

 

显示扩展统计信息,间隔5s,100次

iostat -x -dk 5 100
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await  svctm  %util
sda              19.20   338.20    2.80   14.60    88.00  1411.20   172.32     0.05    2.99   2.71   4.72
sda1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sda2             19.20   294.40    2.80    6.40    88.00  1203.20   280.70     0.05    5.30   4.87   4.48
sda3              0.00    43.80    0.00    8.20     0.00   208.00    50.73     0.00    0.39   0.29   0.24
sdb               0.00     1.60    0.00    0.60     0.00     8.80    29.33     0.00    0.00   0.00   0.00
sdb1              0.00     1.60    0.00    0.60     0.00     8.80    29.33     0.00    0.00   0.00   0.00
sdc               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdc1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdd               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdd1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sde               0.00     0.00    2.40    0.00    16.00     0.00    13.33     0.01    5.67   5.67   1.36
sde1              0.00     0.00    2.40    0.00    16.00     0.00    13.33     0.01    5.67   5.67   1.36
sdf               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdf1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdg               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdg1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdh               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdh1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdi               0.00     0.00   25.00    0.00   100.00     0.00     8.00     0.06    2.46   2.46   6.16
sdi1              0.00     0.00   25.00    0.00   100.00     0.00     8.00     0.06    2.46   2.46   6.16
sdj               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdj1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdk               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdk1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdl               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdl1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdm               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdm1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdn               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdn1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdo               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdo1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdp               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00
sdp1              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

... ...
 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值