一、編譯安裝
首先到官網下載iozone的穩定版源碼
http://www.iozone.org/
然后解壓編譯
tar -vxf iozone3_458.tar cd iozone3_458/src/current make linux-AMD64
最后生成了iozone的可執行文件;
二、使用說明
./iozone -h查看運行參數

[root@localhost iozone3_458]# ./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 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. -+H Hostname Hostname of the PIT server. -+P Service Service of the PIT server. -+z Enable latency histogram logging.
三、常用的參數說明:
-n -g 用於指定測試的filesize的范圍,相對應的-s指定一個確定值;
-y -q 用於指定每次讀寫的blocksize范圍,相對應的-r指定一個定值;
-l -u用於指定使用的用戶數從多少到多少;
-a 如果你指定了范圍類的參數,那么不加-a,最后的結果只有第一列有數據;
-i 指定測試那種類型的讀寫,1-12可供選擇;
-I 跳過緩存直接讀寫磁盤;
-f 指定輸入文件的具體位置,這個文件一定要在你要測的那個磁盤上;
-F 如果你用了 -l -u 的話,那么里面有多少個用戶,就要用這個參數指定多少個文件,文件之間用空格分隔,如:-F tmp.1 tmp.2 tmp.3;
-w 測試之后不刪除測試文件;
-R 產生Excel到標准輸出
-b 指定輸出到指定文件上. 比如 -Rb ttt.xls
-Rb filename.xls 將結果寫到Excel表格中;
四、測試命令示例和結果說明
./iozone -a -i 0 -i 1 -i 2 -i 6 -i 7 -i 8 -n 64m -g 256m -y 256 -q 8192 -I -f /mnt/mfs/1m.tmp -w -Rb ./xls/mfs_i.xls
結果的片段如下:
第一行,就是-i指定的那個參數,比如:表中使Writer Report,那么參數中就有 -i 2, 當然也有可能是-a自動加的;
第二行,各列值就是由"-y 256 -q 8192"指定的,單位是K,表示每次讀寫多大,當然在指定的時候也可以寫M、G但是B是不起作用的;
第一列,各行就是由"-n 64m -g 256m"指定的,表示讀寫的文件依次從64m到256m,以2倍的形式增長;
中間的數據單位都是Kb/s表示讀寫速度;
另外可以看見標紅色字體的部分,就是由於指定了"-I"參數,說明磁盤很希望你用每次讀2048K的大小讀取128M的文件。
五、所有參數具體意義說明
參考網址:http://blog.chinaunix.net/uid-20791108-id-483295.html
-a
用來使用全自動模式。生成包括所有測試操作的報告,使用的塊 大小從4k到16M,文件大小從64k到512M。
-A
這種版本的自動模式提供更加全面的測試但是消耗更多時間。參數–a在文件不小於
32MB時將自動停止使用低於64K的塊大小測試。這節省了許多時間。而參數–A
則告訴Iozone你不介意等待,即使在文件非常大時也希望進行小塊 的測試。
注意: 不推薦在Iozone3.61版中使用這個參數。使用–az –i 0 –i 1替代。
-b filename
Iozone輸出結果時將創建一個兼容Excel的二進制格式的文件。
-B
使用mmap()文件。這將使用mmap()接口來創建並訪問所有測試用的臨時文件。一
些應用程序傾向於將文件當作內存的一塊來看待。這些應用程序對文件執行mmap()
調用,然后就可以以讀寫內存的方式訪問那個塊來完成文件I/O。
-c
計算時間時將close()包括進來。This is useful only if you suspect that close() is
broken in the operating system currently under test. 對於NFS版本3測試而言這將會
很有用,同時它也能幫助我們識別nfs3_commit 是否正常工作。
-C
顯示吞吐量測試中每個客戶傳輸的字節數。如果你的操作系統在文件I/O或進程管
理方面存在飢餓問題時這將派上用場。
-d #
穿過“壁壘”時微秒級的延遲。在吞吐量測試中所有線程或進程在執行測試前都必
須掛起在一道“壁壘”之前。通常來說,所有線程或進程在同一時間被釋放。這個
參數允許在釋放每個進程或線程之間有一定的延遲(微秒級)。Microsecond delay out of barrier. During the throughput tests all threads or processes are
forced to a barrier before beginning the test.
-D
對mmap文件使用msync(MS_ASYNC) 。這告訴操作系統在mmap空間的所有數據
需要被異步地寫到磁盤上。
-e
計算時間時將flush (fsync,fflush) 包括進來。
-E
用來進行一些擴展的測試。只在一些平台上可用。使用pread 接口。
-f filename
用來指定測試時使用的臨時文件的文件名。當使用unmount參數時這將很有用。測試時在每個測試之間進行unmount的話,測試使用的臨時文件在一個可以被卸載的文件夾中是很有必要的。卸載當前工作目錄是不可能的,因為Iozone進程運行於此。
-F filename filename filename …
指定吞吐量測試中每個臨時文件的文件名。文件名的數量應該和指定的進程或線程
數相同。
-g #
設置自動模式可使用的最大文件大小(Kbytes)。
-G
對mmap文件使用msync(MS_SYNC)。這告訴操作系統在mmap空間的所有數據
需要被同步地寫到磁盤上。
-h
顯示幫助。
-H #
使用POSIX異步I/O接口中的#號異步操作。Iozone使用POSIX 異步I/O接口,並使
用bcopy 從異步緩存拷貝回應用程序緩存。一些版本的MSC NASTRAN就是這么進
行I/O操作的。應用程序使用這一技術以便異步I/O可以在一個庫中實現,而不需要
更改程序內模。
-i #
用來指定運行哪個測試。 (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).
總是需要先進行0號測試以便后面的測試有文件可以測試。
也支持使用-i # -i # -i # 以便可以進行多個測試。
-I
對所有文件操作使用VxFS VX_DIRECT 。告訴VXFS 文件系統所有對文件的操作將跨
過緩存直接在磁盤上進行。
-j #
設置訪問文件的跨度為 (# * 塊 大小). Stride read測試將使用這個跨度來讀塊 。
-J # (毫秒級)
在每個I/O操作之前產生指定毫秒的計算延遲。看 -X 和-Y來獲取控制計算延
遲的其他參數。
-k #
Use POSIX async I/O (no bcopy) with # async operations. Iozone will use POSIX async
I/O and will not perform any extra bcopys. The buffers used by Iozone will be handed to
the async I/O system call directly.
-K
在普通測試時生成一些隨機訪問。
-l #
用的時候要與-u搭配比如:"-l 1 -u 4"就表示測試的時候會從一個用戶並發到4個用戶並發,每個用戶單開一個線程
-L #
Set processor cache line size to value (in bytes). Tells Iozone the processor cache line size.
This is used internally to help speed up the test.
-m
Tells Iozone to use multiple buffers internally. Some applications read into a single
buffer over and over. Others have an array of buffers. This option allows both types of
applications to be simulated. Iozone’s default behavior is to re-use internal buffers.
This option allows one to override the default and to use multiple internal buffers.
-M
Iozone will call uname() and will put the string in the output file.
-n #
為自動模式設置最小文件大小(Kbytes)。
-N
報告結果以毫秒每操作的方式顯示。
-o
寫操作是同步寫到磁盤的。 (O_SYNC). Iozone 會以O_SYNC 標志打開文件。這強制所有寫操作完全寫入磁盤后才返回測試。
-O
報告結果以操作每秒的方式顯示。
-p
This purges the processor cache before each file operation. Iozone will allocate another
internal buffer that is aligned to the same processor cache boundary and is of a size that
matches the processor cache. It will zero fill this alternate buffer before beginning each test.
This will purge the processor cache and allow one to see the memory subsystem without
the acceleration due to the processor cache.
-P #
Bind processes/threads to processors, starting with this cpu #. Only available on some
platforms. The first sub process or thread will begin on the specified processor. Future processes or threads will be placed on the next processor. Once the total number of cpus is exceeded then future processes or threads will be placed in a round robin fashion.
-q #
設置自動模式下使用的最大塊大小(Kbytes) 。也可以通過-q #k ( Kbytes) 或 -q #m ( Mbytes) 或 -q #g ( Gbytes)。設置最小塊大小見 –y 。
-Q
Create offset/latency files. Iozone will create latency versus offset data files that can be
imported with a graphics package and plotted. This is useful for finding if certain offsets
have very high latencies. Such as the point where UFS will allocate its first indirect block.
One can see from the data the impacts of the extent allocations for extent based filesystems
with this option.
-r #
指定測試塊 大小,K字節。也可以通過-r #k (Kbytes) 或 -r #m (Mbytes) 或 -r #g (Gbytes).
-R
生成Excel報告. Iozone將生成一個兼容Excel的標准輸出報告。這個文件可以使用
Microsoft Excel打開,可以創建一個文件系統性能的圖表。注意:3D圖表是面向列
的。畫圖時你需要選擇這項因為Excel默認處理面向行的數據。
-s #
指定測試文件大小,K字節。也可以通過-s #k (Kbytes) 或 -s #m (Mbytes) 或 -s #g (Gbytes).
-S #
Set processor cache size to value (in Kbytes). This tells Iozone the size of the processor cache.
It is used internally for buffer alignment and for the purge functionality.
-t #
以吞吐量模式運行Iozone。這一選項允許用戶指定測試時使用多少個線程或者進程。
-T
吞吐量測試時使用POSIX線程。僅在兼容POSIX線程的平台上可用。
-u #
Set the upper limit on number of processes to run. When running throughput tests this
option allows the user to specify the greatest number of processes or threads to start.
This option should be used in conjunction with the -l option.
-U mountpoint
在測試之間卸載並重新掛載掛載點。這保證了緩存cache不包含任何測試過的文件。
-v
顯示Iozone的版本號。
-V #
Specify a pattern that is to be written to the temporary file and validated for accuracy in
each of the read tests.
-w
當臨時文件使用完畢時不刪除它們。把它們留在文件系統中。
-W
讀或寫時鎖文件。
-x
關閉“stone-walling”. Stonewalling 是 Iozone內部使用的一種技術。它是在進行吞吐量測試時使用的。程序啟動所有線程或進程然后將它們暫停在“壁壘”前。
一旦它們都做好准備工作,它們將被同時釋放。當其中任何一個線程或進程完成工作,整個測試就終止了並計算到達這個點時所有I/O的吞吐量。這保證了整個測試進行時所有的進程和線程都是並行的。這個標志位允許取消 stonewalling並看看會發生什么。
-X filename
Use this file for write telemetry information. The file contains triplets of information:
Byte offset, size of transfer, compute delay in milliseconds. This option is useful if one has
taken a system call trace of the application that is of interest. This allows Iozone to replicate the I/O operations that this specific application generates and provide benchmark results for this file behavior. (if column 1 contains # then the line is a comment)
-y #
設置自動模式下使用的最小塊大小(Kbytes) 。也可以通過-y #k ( Kbytes) 或 -y #m ( Mbytes) 或 -y #g ( Gbytes)。設置最大塊大小見 –y 。
-Y filename
Use this file for read telemetry information. The file contains triplets of information:
Byte offset, size of transfer, compute delay in milliseconds. This option is useful if one has
taken a system call trace of the application that is of interest. This allows Iozone to replicate the I/O operations that this specific application generates and provide benchmark results for this file behavior. (if column 1 contains # then the line is a comment)
-z
Used in conjunction with -a to test all possible record sizes. Normally Iozone omits testing
of small record sizes for very large files when used in full automatic mode. This option forces
Iozone to include the small record sizes in the automatic tests also.
-Z
啟動混合 mmap I/O 和文件 I/O.
-+m filename
Use this file to obtain the configuration information of the clients for cluster testing. The file contains one line for each client. Each line has three fields. The fields are space delimited. A # sign in column zero is a comment line. The first field is the name of the client. The second field is the path, on the client, for the working directory where Iozone will execute. The third field is the path, on the client, for the executable Iozone.
To use this option one must be able to execute commands on the clients without being challenged for a password. Iozone will start remote execution by using “rsh”.
-+u
Enable CPU utilization mode.
-+d
啟動診斷模式。在這一模式下每個字節都將被驗證。這在懷疑I/O子系統出錯時有用。
-+p percent_read
Set the percentage of the thread/processes that will perform random read testing. Only valid in throughput mode and with more than 1 process/thread.
-+r
Enable O_RSYNC and O_SYNC for all I/O testing.
-+t
啟動網絡性能測試。需要 -+m
-+A
Enable madvise. 0 = normal, 1=random, 2=sequential, 3=dontneed, 4=willneed.
For use with options that activate mmap() file I/O. See: -B