2009年3月24日星期二

基準測試1-Gnu dd篇(即DISK IO)

從上次學習了Fenng同學的演講,對自己以前的工作做了一下檢討,爲了做到心中有底,學習一下測試的技巧,以後工作中可能會用到,今天學習dd
dd ,或 Gnu dd主要是對系統IO進行的吞吐量throughput進行測試

1,write 測試
[root@rac2 home]# time dd if=/dev/zero of=/home/test_write bs=4k count=1000000 [[A1000000+0 records in
1000000+0 records out
4096000000 bytes (4.1 GB) copied, 67.9907 seconds, 60.2 MB/s

real 1m11.611s
user 0m0.385s
sys 0m8.106s

另一個窗口是iostate的結果
[root@rac2 ~]# iostat 1 100
Linux 2.6.18-92.el5 (rac2) 03/25/2009

avg-cpu: %user %nice %system %iowait %steal %idle
1.17 0.00 1.07 6.89 0.00 90.88

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 18.09 593.05 7944.87 1947100 26084682

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 1.50 98.00 0.00 0.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 118.00 0.00 118928.00 0 118928

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 2.50 53.50 0.00 43.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 127.00 8.00 107864.00 8 107864

avg-cpu: %user %nice %system %iowait %steal %idle
1.00 0.00 17.91 81.09 0.00 0.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 121.78 0.00 113005.94 0 114136

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.51 98.49 0.00 0.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 117.00 0.00 119272.00 0 119272

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.00 99.00 0.00 0.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 117.00 0.00 119808.00 0 119808

avg-cpu: %user %nice %system %iowait %steal %idle
1.49 0.00 32.84 64.18 0.00 1.49
...

sata的disk, dell的pc, 看一樣子是 60MB/s (B=byte b=bit)

第二步:read/write throughput 測試:

[root@rac2 home]# time dd if=/home/test_write of=/home/test_rw bs=4k count=1000000
1000000+0 records in
1000000+0 records out
4096000000 bytes (4.1 GB) copied, 99.2975 seconds, 41.2 MB/s

real 1m39.313s
user 0m0.437s
sys 0m10.648s



iostate取中間的一段:
...
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 559.00 134520.00 24.00 134520 24

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 8.00 69.50 0.00 22.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 479.21 84483.17 1037.62 85328 1048

avg-cpu: %user %nice %system %iowait %steal %idle
0.51 0.00 13.13 78.79 0.00 7.58

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 472.00 110424.00 4608.00 110424 4608

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.99 63.68 0.00 34.33

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 109.00 512.00 108544.00 512 108544

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 1.98 60.89 0.00 36.63

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 118.00 0.00 120832.00 0 120832

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.50 48.50 0.00 50.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 116.00 0.00 117760.00 0 117760

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.50 75.50 0.00 23.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 119.00 1800.00 113680.00 1800 113680

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.50 70.35 0.00 29.15

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 185.00 0.00 90904.00 0 90904

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 2.00 49.00 0.00 48.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 224.00 512.00 24784.00 512 24784

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 12.94 73.13 0.00 13.43

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 534.00 126568.00 5864.00 126568 5864

...

第三步, read throughput 測試:
[root@rac2 home]# time dd if=/home/test_write of=/dev/null bs=4k count=1000000
1000000+0 records in
1000000+0 records out
4096000000 bytes (4.1 GB) copied, 1.82309 seconds, 2.2 GB/s

real 0m1.824s
user 0m0.306s
sys 0m1.514s

超快的結果! iostat還沒有反映過來結束了!
[root@rac2 ~]# iostat 1 100
Linux 2.6.18-92.el5 (rac2) 03/25/2009

avg-cpu: %user %nice %system %iowait %steal %idle
0.99 0.02 1.21 8.33 0.00 89.45

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 23.32 1412.55 9241.57 5677404 37144258

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

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.00 0.00 0.00 0 0

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.50 0.00 0.00 99.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 2.00 0.00 24.00 0 24

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

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.00 0.00 0.00 0 0

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 0.00 0.00 0.00 99.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 1.98 0.00 79.21 0 80

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

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 2.00 0.00 40.00 0 40

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.50 0.00 0.00 99.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 3.00 0.00 32.00 0 32

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

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 8.00 0.00 168.00 0 168

avg-cpu: %user %nice %system %iowait %steal %idle
0.50 0.00 6.50 0.00 0.00 93.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.00 0.00 0.00 0 0

avg-cpu: %user %nice %system %iowait %steal %idle
9.50 0.00 41.00 0.00 0.00 49.50

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 8.00 0.00 184.00 0 184

avg-cpu: %user %nice %system %iowait %steal %idle
5.50 0.00 28.50 0.00 0.00 66.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.00 0.00 0.00 0 0

avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 1.00 0.00 0.00 99.00

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 43.00 0.00 496.00 0 496

以上是普通的pc, sata硬盤的
還沒有完以後有心得再寫!
準備在溫習一下bonnie, bonnie++
學習一下:iozone http://www.iozone.org/

參考:
http://www.dbanotes.net/database/linux_io_benchmark_tools_compare.html
http://morphis.spaces.live.com/blog/cns!10886869AD52662A!1058.trak
http://hi.baidu.com/thinkinginlamp/blog/item/3f310c336edcfcfc1a4cff8a.html

没有评论:

发表评论