iozone的使用

本文详细讲述使用iozone进行io读写的测试,包括iozone的交叉编译以及参数设置和结果的解析。


iozone简介

iozone是一个文件系统的benchmark工具,可以测试不同的操作系统中文件系统的读写性能。 可以测试 Read, write, re-read,re-write, read backwards, read strided, fread, fwrite, random read, pread, mmap, aio_read, aio_write 等等不同的模式下的硬盘的性能。
也就是说,这个工具专门用来测试文件系统的读写性能。


参考资料


交叉编译

因为我是使用ARCH arm64的,在提供的官方源码中没有arm64的编译选项,因此需要进行交叉编译。指定CCGCC参数为自己的交叉工具链gcc即可,
编译命令如下:

1
2
victor@victor-HP:~/victor/xxx_project/iozone3_482/src/current$ make CC=~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc \
GCC=~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc linux-arm

编译过程如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
victor@victor-HP:~/victor/xxx_project/iozone3_482/src/current$ make CC=~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc GCC=~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc linux-arm

Building iozone for Linux-arm

~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -c -O3 -Dunix -DHAVE_ANSIC_C -DASYNC_IO -DHAVE_PREAD \
-DNAME='"linux-arm"' -DLINUX_ARM -DSHARED_MEM \
-Dlinux -D_LARGEFILE64_SOURCE iozone.c \
-o iozone_linux-arm.o
~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -c -O3 -Dunix -DHAVE_ANSIC_C -DASYNC_IO -D_LARGEFILE64_SOURCE \
-DSHARED_MEM -Dlinux libbif.c -o libbif.o
~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -c -O3 -Dunix -Dlinux -DHAVE_ANSIC_C -DASYNC_IO \
-D_LARGEFILE64_SOURCE libasync.c -o libasync.o

Building fileop for Linux-arm

~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -Wall -c -O3 fileop.c -o fileop_linux-arm.o

Building the pit_server

~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -c pit_server.c -o pit_server.o
~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -O3 iozone_linux-arm.o libbif.o libasync.o \
-lrt -lpthread -o iozone
~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -O3 -Dlinux fileop_linux-arm.o -o fileop
~/victor/xxx_project/prebuilt/toolchains/aarch64-imx6-linux/bin/aarch64-poky-linux-gcc -O3 -Dlinux pit_server.o -o pit_server

#### make completed successfully (6 seconds) ####

查看文件类型可以看到是arch arm64的格式了,可以将交叉编译出来的应用程序iozone拷贝到板子上运行。

1
2
victor@victor-HP:~/victor/xxx_project/iozone3_482/src/current$ file iozone
iozone: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.14.0, BuildID[sha1]=e3c5bd74f79e76a96d80bc417caf52551a3e8136, not stripped


iozone的使用

测试命令如下:./iozone -azecI -+n -L64 -S32 -r2m -s128m -i0 -i2 -+b 400000,30000 -w -f testfile -Rb /var/test/emmc_test.xls

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# ./iozone -azecI -+n -L64 -S32 -r2m -s128m -i0 -i2 -+b 400000,30000 -w -f testfile -Rb /var/test/emmc_test.xls
Iozone: Performance Test of File I/O
Version $Revision: 3.482 $
Compiled for 64 bit mode.
Build: linux-arm

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, Gavin Brebner,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
[ 62.083472] random: crng init done
Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
Vangel Bojaxhi, Ben England, Vikentsi Lapa,
Alexey Skidanov, Sudhir Kumar.

Run began: Thu Jan 1 00:01:02 1970

Auto Mode
Cross over of record size disabled.
Include fsync in write timing
Include close in write timing
O_DIRECT feature enabled
No retest option selected
Record Size 2048 kB
File size set to 131072 kB
Setting no_unlink
Command line used: ./iozone -azecI -+n -L64 -S32 -r2m -s128m -i0 -i2 -+b 400000,30000 -w -f testfile
Output is in kBytes/sec
Time Resolution = 0.000001 seconds.
Processor cache size set to 32 kBytes.
Processor cache line size set to 64 bytes.
File stride size set to 17 * record size.
Burst size set to 400000 Kbytes.
Burst sleep duration set to 30000 msec
random random bkwd record stride

kB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread
freread
131072 2048 10680 0 79625 10938

根据测试结果我们知道,随机写128MBytes的传输速度为10MB/s,随机读的传输速度约为80MB/s。读的性能与datasheet上提供的Sequential read的差不多的,但是写的性能与Sequential write还是有一定的差距。

各个参数定义如下:

  • a: Auto mode
  • z: Used in conjunction with -a to test all possible record sizes
  • e: Include flush (fsync,fflush) in the timing calculations
  • c: Include close in the timing calculations
  • I: Use VxFS VX_DIRECT, O_DIRECT,or O_DIRECTIO for all file operations
  • -+n: No retests selected
  • L64: Set processor cache line size to 64 Bytes
  • S32: Set processor cache size to 32KBytes
  • r2m: record size 2M
  • s128m: file size 128M
  • i0: Test to run write/rewrite
  • i2: Test to run random-read/write
  • -+b 400000,30000: burst size 400000KBytes,sleep between burst 30000ms
  • w: Do not unlink temporary file
  • f: set testfile filename to use
  • R: Generate Excel report
  • b: Filename Create Excel worksheet file,emmc_test.xls

iozone用法帮助

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# ./iozone -h                                               
iozone: help mode

Usage: iozone [-s filesize_kB] [-r record_size_kB] [-f [path]filename] [-h]
[-i test] [-E] [-p] [-a] [-A] [-z] [-Z] [-m] [-M] [-t children]
[-l min_number_procs] [-u max_number_procs] [-v] [-R] [-x] [-o]
[-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] [-L cacheline_size] [-K] [-g maxfilesize_kB]
[-n minfilesize_kB] [-N] [-Q] [-P start_cpu] [-e] [-c] [-b Excel.xls]
[-J milliseconds] [-X write_telemetry_filename] [-w] [-W]
[-Y read_telemetry_filename] [-y minrecsize_kB] [-q maxrecsize_kB]
[-+u] [-+m cluster_filename] [-+d] [-+x multiplier] [-+p # ]
[-+r] [-+t] [-+X] [-+Z] [-+w percent dedupable] [-+y percent_interior_dedup]
[-+C percent_dedup_within] [-+a zero_pct] [-+Q dedup granule size]
[-+M dedup+compress flag ]

-a Auto mode
-A Auto2 mode
-b Filename Create Excel worksheet file
-B Use mmap() files
-c Include close in the timing calculations
-C Show bytes transferred by each child in throughput testing
-d # Microsecond delay out of barrier
-D Use msync(MS_ASYNC) on mmap files
-e Include flush (fsync,fflush) in the timing calculations
-E Run extension tests
-f filename to use
-F filenames for each process/thread in throughput test
-g # Set maximum file size (in kBytes) for auto mode (or #m or #g)
-G Use msync(MS_SYNC) on mmap files
-h help
-H # Use POSIX async I/O with # async operations
-i # Test to run (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)
-I Use VxFS VX_DIRECT, O_DIRECT,or O_DIRECTIO for all file operations
-j # Set stride of file accesses to (# * record size)
-J # milliseconds of compute cycle before each I/O operation
-k # Use POSIX async I/O (no bcopy) with # async operations
-K Create jitter in the access pattern for readers
-l # Lower limit on number of processes to run
-L # Set processor cache line size to value (in bytes)
-m Use multiple buffers
-M Report uname -a output
-n # Set minimum file size (in kBytes) for auto mode (or #m or #g)
-N Report results in microseconds per operation
-o Writes are synch (O_SYNC)
-O Give results in ops/sec.
-p Purge on
-P # Bind processes/threads to processors, starting with this cpu
-q # Set maximum record size (in kBytes) for auto mode (or #m or #g)
-Q Create offset/latency files
-r # record size in Kb
or -r #k .. size in kB
or -r #m .. size in MB
or -r #g .. size in GB
-R Generate Excel report
-s # file size in Kb
or -s #k .. size in kB
or -s #m .. size in MB
or -s #g .. size in GB
-S # Set processor cache size to value (in kBytes)
-t # Number of threads or processes to use in throughput test
-T Use POSIX pthreads for throughput tests
-u # Upper limit on number of processes to run
-U Mount point to remount between tests
-v version information
-V # Verify data pattern write/read
-w Do not unlink temporary file
-W Lock file when reading or writing
-x Turn off stone-walling
-X filename Write telemetry file. Contains lines with (offset reclen compute_time) in ascii
-y # Set minimum record size (in kBytes) for auto mode (or #m or #g)
-Y filename Read telemetry file. Contains lines with (offset reclen compute_time) in ascii
-z Used in conjunction with -a to test all possible record sizes
-Z Enable mixing of mmap I/O and file I/O
-+b #,# burst size (KB),sleep between burst (mili-second)
-+E Use existing non-Iozone file for read-only testing
-+F Truncate file before write in thread_mix_test
-+J Include think time (-j #) in throughput calculation
-+K Sony special. Manual control of test 8.
-+m Cluster_filename Enable Cluster testing
-+d File I/O diagnostic mode. (To troubleshoot a broken file I/O subsystem)
-+u Enable CPU utilization output (Experimental)
-+x # Multiplier to use for incrementing file and record sizes
-+p # Percentage of mix to be reads
-+r Enable O_RSYNC|O_SYNC for all testing.
-+t Enable network performance test. Requires -+m
-+n No retests selected.
-+k Use constant aggregate data set size.
-+q Delay in seconds between tests.
-+l Enable record locking mode.
-+L Enable record locking mode, with shared file.
-+B Sequential mixed workload.
-+D Enable O_DSYNC mode.
-+A # Enable madvise. 0 = normal, 1=random, 2=sequential
3=dontneed, 4=willneed
-+N Do not truncate existing files on sequential writes.
-+S # Dedup-able data is limited to sharing within each numerically
identified file set.
-+W # Add this value to the child thread ID, so that additional files
can be added while maintaining the proper dedupability with previously
existing files that are within the same seed group (-+S).
-+V Enable shared file. No locking.
-+X Enable short circuit mode for filesystem testing ONLY
ALL Results are NOT valid in this mode.
-+Z Enable old data set compatibility mode. WARNING.. Published
hacks may invalidate these results and generate bogus, high
values for results.
-+w ## Percent of dedup-able data in buffers.
-+y ## Percent of dedup-able within & across files in buffers.
-+C ## Percent of dedup-able within & not across files in buffers.
-+a ## Percent of data that is compressible.
-+Q ## Dedup granule size.
-+H Hostname Hostname of the PIT server.
-+P Service Service of the PIT server.
-+z Enable latency histogram logging.
-+M Enable Dedup+compress option. (Experimental).
-+R enable iozone to take filenames from a file.

Title:iozone的使用

Author:Victor Huang

Time:2019-03-17 / 16:03

Link:http://wowothink.com/b871283/

License: Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)