为了测试nfs协议性能,安装iozone。
测试环境:虚拟机中的ubuntu10.10 nfs server
虚拟机中的ubuntu8.04 nfs client
在nfs客户端上安装iozone:
1. sudo apt-get install iozone3
2. 开始测试本地文件系统
Usage: iozone [-s filesize_Kb] [-r record_size_Kb ] [-f [path]filename]
[-i test] [-E] [-p] [-a] [-A] [-z] [-Z] [-m] [-M] [-t children] [-h] [-o]
[-l min_number_procs] [-u max_number_procs] [-v] [-R] [-x]
[-d microseconds] [-F path1 path2...] [-V pattern] [-j stride]
[-T] [-C] [-B] [-D] [-G] [-I] [-H depth] [-k depth] [-U mount_point]
[-S cache_size] [-O] [-K] [-L line_size] [-g max_filesize_Kb]
[-n min_filesize_Kb] [-N] [-Q] [-P start_cpu] [-c] [-e] [-b filename]
[-J milliseconds] [-X filename] [-Y filename] [-w] [-W]
[-y min_recordsize_Kb] [-q max_recordsize_Kb] [-+m filename]
[-+u ] [ -+d ] [-+p percent_read] [-+r] [-+t ] [-+A #]
每个参数的解析:
- a 用来使用全自动模式。生成包括所有测试操作的报告,使用的块 大小从4k 到 16M ,文件大小从 64k 到 512M 。
-A 这种版本的自动模式提供更加全面的测试但是消耗更多时间。参数–a 在文件不小于 32MB 时将自动停止使用低于 64K 的块大小测试。这节省了许多时间。而参数 –A 则告诉 Iozone 你不介意等待,即使在文件非常大时也希望进行小块 的测试。
注意: 不推荐在Iozone3.61 版中使用这个参数。使用 –az –i 0 –i 1 替代。
-R 产生 Excel 到标准输出
-b 指定输出到指定文件上 . 比如 -Rb ttt.xls
-i N 用来选择测试项 , 比如 Read/Write/Random 比较常用的是 0 1 2, 可以指定成 -i 0 -i 1 – i 2 。
0=write/rewrite
1=read/re-read
2=random-read/write
3=Read-backwards
4=Re-write-record
5=stride-read
6=fwrite/re-fwrite
7=fread/Re-fread
8=random mix
9=pwrite/Re-pwrite
10=pread/Re-pread
11=pwritev/Re-pwritev
12=preadv/Re-preadv
-r block size 指定一次写入 / 读出的块大小
-s file size 指定测试文件的大小
-f filename 指定测试文件的名字 , 完成后会自动删除 ( 这个文件必须指定你要测试的那个硬盘中 )
批量测试项:
-g -n 指定测试文件大小范围 , 最大测试文件为 4G, 可以这样写 -g 4G
-y -q 指定测试块的大小范围
测试命令行;iozone -a -s 1G -i 0 -i 1 -Rb ttt.xls
结果:
The top row is records sizes, the left column is file sizes
"Writer report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"1048576" 6746
"Re-writer report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"1048576" 16190
"Reader report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"1048576" 19742
"Re-Reader report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"1048576" 19418
配置完nfs后,开始测试
输入命令:iozone -Rab test.xls -i 0 -s 512B -+u -U /home/jellyjar/Desktop/nfs-try2.0
解释:测试nfs挂载的文件夹的iops,读取512B的文件,并测试cpu利用率
结果:
Excel output is below:
"Writer report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"512" 148281 280087 309374 162233 266932 333976 253214 355036
"Re-writer report"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"512" 442520 507410 491818 340410 530559 238588 598131 550520
"Writer CPU utilization report (Zero values should be ignored)"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"512" 0.83 8.97 4.32 8.85 5.12 5.20 5.10 9.92
"Re-writer CPU utilization report (Zero values should be ignored)"
"4" "8" "16" "32" "64" "128" "256" "512" "1024" "2048" "4096" "8192" "16384"
"512" 5.07 6.06 4.39 6.53 13.09 5.28 5.66 4.10
再来一个多线程的:
命令: iozone -Rb try1.xls /home/jellyjar/Desktop/nfs-try2.0 -i 0 -i 1 -t 5 -C -+u |tee a.log
解释: 开启5个线程测试读写挂载的nfs文件夹,显示每个子线程的iops,并输出到日志文件a.log
输出结果:
Iozone: Performance Test of File I/O
Version $Revision: 3.279 $
Compiled for 32 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy,
Erik Habbinga, Kris Strecker, Walter Wong.
Run began: Thu Mar 10 04:14:00 2011
Excel chart generation enabled
CPU utilization Resolution = -0.000 seconds.
CPU utilization Excel chart enabled
Command line used: iozone -Rb try1.xls -i 0 -i 1 -t 5 -C -+u /home/jellyjar/Desktop/nfs-try2.0
Output is in Kbytes/sec
Time Resolution = 0.000002 seconds.
Processor cache size set to 1024 Kbytes.
Processor cache line size set to 32 bytes.
File stride size set to 17 * record size.
Throughput test with 5 processes
Each process writes a 512 Kbyte file in 4 Kbyte records
Children see throughput for 5 initial writers = 120676.52 KB/sec
Parent sees throughput for 5 initial writers = 1569.77 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 118740.77 KB/sec
Avg throughput per process = 24135.30 KB/sec
Min xfer = 0.00 KB
CPU Utilization: Wall time 0.295 CPU time 0.072 CPU utilization 24.39 %
Child[0] xfer count = 240.00 KB, Throughput = 1935.75 KB/sec, wall= 0.215, cpu= 0.008, %= 3.72
Child[1] xfer count = 512.00 KB, Throughput = 118740.77 KB/sec, wall= 0.004, cpu= 0.004, %= 92.47
Child[2] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.084, cpu= 0.004, %= 4.76
Child[3] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.004, cpu= 0.004, %=100.00
Child[4] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.295, cpu= 0.052, %= 17.62
Children see throughput for 5 rewriters = 368879.69 KB/sec
Parent sees throughput for 5 rewriters = 8121.30 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 368879.69 KB/sec
Avg throughput per process = 73775.94 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.001 CPU time 0.000 CPU utilization 0.00 %
Child[0] xfer count = 512.00 KB, Throughput = 368879.69 KB/sec, wall= 0.001, cpu= 0.000, %= 0.00
Child[1] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu=-0.000, %= 0.00
Child[2] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Child[3] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu=-0.000, %= 0.00
Child[4] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Children see throughput for 5 readers = 420023.84 KB/sec
Parent sees throughput for 5 readers = 43552.16 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 420023.84 KB/sec
Avg throughput per process = 84004.77 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.001 CPU time 0.000 CPU utilization 0.00 %
Child[0] xfer count = 512.00 KB, Throughput = 420023.84 KB/sec, wall= 0.001, cpu=-0.000, %= 0.00
Child[1] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Child[2] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Child[3] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu=-0.000, %= 0.00
Child[4] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu=-0.000, %= 0.00
Children see throughput for 5 re-readers = 372895.97 KB/sec
Parent sees throughput for 5 re-readers = 19842.69 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 372895.97 KB/sec
Avg throughput per process = 74579.19 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.001 CPU time -0.000 CPU utilization -0.00 %
Child[0] xfer count = 512.00 KB, Throughput = 372895.97 KB/sec, wall= 0.001, cpu= 0.000, %= 0.00
Child[1] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu=-0.000, %= 0.00
Child[2] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Child[3] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
Child[4] xfer count = 0.00 KB, Throughput = 0.00 KB/sec, wall= 0.000, cpu= 0.000, %= 0.00
"Throughput report Y-axis is type of test X-axis is number of processes"
"Record size = 4 Kbytes "
"Output is in Kbytes/sec"
" Initial write " 120676.52
" Rewrite " 368879.69
" Read " 420023.84
" Re-read " 372895.97
"CPU utilization report Y-axis is type of test X-axis is number of processes"
"Record size = 4 Kbytes "
"Output is in CPU%"
" Initial write " 24.39
" Rewrite " 0.00
" Read " 0.00
" Re-read " 0.00
iozone test complete.
命令:iozone -i 0 -u 32 -l 32 -w -s 1M
结果:
Iozone: Performance Test of File I/O
Version $Revision: 3.279 $
Compiled for 32 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy,
Erik Habbinga, Kris Strecker, Walter Wong.
Run began: Thu Mar 10 04:32:42 2011
Setting no_unlink
File size set to 1024 KB
Command line used: iozone -i 0 -u 32 -l 32 -w -s 1M
Output is in Kbytes/sec
Time Resolution = 0.000002 seconds.
Processor cache size set to 1024 Kbytes.
Processor cache line size set to 32 bytes.
File stride size set to 17 * record size.
Min process = 32
Max process = 32
Throughput test with 32 processes
Each process writes a 1024 Kbyte file in 4 Kbyte records
Children see throughput for 32 initial writers = 204799.92 KB/sec
Parent sees throughput for 32 initial writers = 40.96 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 204799.92 KB/sec
Avg throughput per process = 6400.00 KB/sec
Min xfer = 0.00 KB
Children see throughput for 32 rewriters = 380114.06 KB/sec
Parent sees throughput for 32 rewriters = 12984.03 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 380114.06 KB/sec
Avg throughput per process = 11878.56 KB/sec
Min xfer = 0.00 KB
iozone test complete.
命令;iozone /home/jellyjar/Desktop/nfs-try2.0 -i 0 -i 1 -t -u 64 -l 64 -+u |tee b.log
结果:
Iozone: Performance Test of File I/O
Version $Revision: 3.279 $
Compiled for 32 bit mode.
Build: linux
Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy,
Erik Habbinga, Kris Strecker, Walter Wong.
Run began: Thu Mar 10 04:46:59 2011
CPU utilization Resolution = -0.000 seconds.
CPU utilization Excel chart enabled
Command line used: iozone -i 0 -i 1 -t -u -l 64 -+u /home/jellyjar/Desktop/nfs-try2.0 64
Output is in Kbytes/sec
Time Resolution = 0.000002 seconds.
Processor cache size set to 1024 Kbytes.
Processor cache line size set to 32 bytes.
File stride size set to 17 * record size.
Min process = 64
Max process = 64
Throughput test with 64 processes
Each process writes a 512 Kbyte file in 4 Kbyte records
Children see throughput for 64 initial writers = 125706.48 KB/sec
Parent sees throughput for 64 initial writers = 141.35 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 125706.48 KB/sec
Avg throughput per process = 1964.16 KB/sec
Min xfer = 0.00 KB
CPU Utilization: Wall time 1.304 CPU time 0.652 CPU utilization 49.99 %
Children see throughput for 64 rewriters = 315260.94 KB/sec
Parent sees throughput for 64 rewriters = 5949.82 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 315260.94 KB/sec
Avg throughput per process = 4925.95 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.002 CPU time 0.000 CPU utilization 0.00 %
Children see throughput for 64 readers = 662425.31 KB/sec
Parent sees throughput for 64 readers = 11300.69 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 662425.31 KB/sec
Avg throughput per process = 10350.40 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.001 CPU time 0.000 CPU utilization 0.00 %
Children see throughput for 64 re-readers = 575900.00 KB/sec
Parent sees throughput for 64 re-readers = 11709.79 KB/sec
Min throughput per process = 0.00 KB/sec
Max throughput per process = 575900.00 KB/sec
Avg throughput per process = 8998.44 KB/sec
Min xfer = 0.00 KB
CPU utilization: Wall time 0.004 CPU time 0.004 CPU utilization 100.00 %