IOzone I/O测试工具使用说明 您所在的位置:网站首页 512k什么意思 IOzone I/O测试工具使用说明

IOzone I/O测试工具使用说明

2024-07-12 01:45| 来源: 网络整理| 查看: 265

IOzone磁盘读写工具使用说明 0. IOzone简介1. 下载及安装1.1 下载1.2 编译并安装1.3 IOzone 效用测量什么? 2. IOzone参数介绍3. 10 个 IOZone 示例3.1 使用默认值运行所有 IOZone 测试3.2 使用 iozone -b 将输出保存到电子表格3.3 使用 iozone -i 仅运行特定类型的测试3.4 使用 iozone -s 指定文件大小3.5 使用 iozone -r 指定测试的记录大小3.5 使用 iozone -r 指定测试的记录大小3.6 结合文件大小和记录大小3.7 使用 iozone -t 进行吞吐量测试3.8 使用 iozone -+u 包含 CPU 使用率3.9 使用 iozone -g 增加文件大小3.10 使用 iozone -F 一起测试多个挂载点

0. IOzone简介

  IOzone是一个开源文件系统基准工具,用来测试文件系统的读写性能,也可以进行测试磁盘读写性能。Iozone能够运行于许多平台。这份文档涵盖Iozone所执行的许多不同类型的操作和它的所有命令行参数。

  Iozone执行以下操作测试文件I/O性能:

  Read, write, re-read, re-write, read backwards, read strided, fread, fwrite, random read/write, pread/pwrite variants, aio_read, aio_write, mmap,

1. 下载及安装 1.1 下载

方式一:网站下载http://www.iozone.org/ 方式二:

wget http://www.iozone.org/src/current/iozone3_394.tar

一旦你获得了IOzone的源码,你将拥有以下12个文件。

· iozone.c (源码) · libasync.c (源码) · makefile (makefile) · libbif.c (源码) · Iozone_msword_98.doc (Word格式文档) · iozone.1 (nroff格式文档) · gnuplot.dem (gnuplot示例文件) · gnuplotps.dem (带附言的gnuplot示例文件) · read_telemetry (用于telemetry读测试的示例文件) · write_telemetry (用于telemetry写测试的示例文件) · Run_rules.doc (程序运行规则) · Changes.txt (Iozone开发版本升级记录)

1.2 编译并安装 tar xvf iozone3_394.tar #解压(注意不要有中文名目录) cd iozone3_394/src/current #进入安装目录 make #编译 make linux #安装 1.3 IOzone 效用测量什么?

IOzone 执行以下 13 种测试。

Read——表示读取文件系统中已存在的文件的性能。Write——表示将新文件写入文件系统的性能。当一个新文件被写入时,不仅仅是那些文件中的数据需要被存储,还包括那些用于定位数据存储在存储介质的具体位置的额外信息。这些额外信息被称作“元数据”。它包括目录信息,所分配的空间和一些与该文件有关但又并非该文件所含数据的其他数据。拜这些额外信息所赐,Write的性能通常会比Re-write的性能低。Re-read——读取文件后,表示再次读取文件的性能。当一个已存在的文件被写入时,所需工作量较少,因为此时元数据已经存在。Re-write的性能通常比Write的性能高。Re-write——表示写入现有文件的性能。Re-Read性能会高些,因为操作系统通常会缓存最近读过的文件数据。这个缓存可以被用于读以提高性能。Random Read——表示通过从文件中读取随机信息来读取文件的性能。即这不是顺序读取。Random Write——指示在各种随机位置写入文件的性能。即这不是顺序写入。Backward Read——测试使用倒序读一个文件的性能。这种读文件方法可能看起来很可笑,事实上,有些应用确实这么干。MSC Nastran是一个使用倒序读文件的应用程序的一个例子。它所读的文件都十分大(大小从G级别到T级别)。尽管许多操作系统使用一些特殊实现来优化顺序读文件的速度,很少有操作系统注意到并增强倒序读文件的性能。Record Re-Write——测试写与覆盖写一个文件中的特定块的性能。这个块可能会发生一些很有趣的事。如果这个块足够小(比CPU数据缓存小),测出来的性能将会非常高。如果比CPU数据缓存大而比TLB小,测出来的是另一个阶段的性能。如果比此二者都大,但比操作系统缓存小,得到的性能又是一个阶段。若大到超过操作系统缓存,又是另一番结果。Stride Read——测试跳跃读一个文件的性能。举例如下:在0偏移量处读4Kbytes,然后间隔200Kbytes,读4Kbytes,再间隔200Kbytes,如此反复。此时的模式是读4Kbytes,间隔200Kbytes并重复这个模式。这又是一个典型的应用行为,文件中使用了数据结构并且访问这个数据结构的特定区域的应用程序常常这样做。Fread——测试调用库函数fread()来读文件的性能。这是一个执行缓存与阻塞读操作的库例程。缓存在用户空间之内。如果一个应用程序想要读很小的传输块,fwrite()函数中的缓存与阻塞I/O功能能通过减少实际操作系统调用并在操作系统调用时增加传输块的大小来增强应用程序的性能。Fwrite——测试调用库函数fwrite()来写文件的性能。这是一个执行缓存与阻塞写操作的库例程。缓存在用户空间之内。如果一个应用程序想要写很小的传输块,fwrite()函数中的缓存与阻塞I/O功能能通过减少实际操作系统调用并在操作系统调用时增加传输块的大小来增强应用程序的性能。Freread——这个测试与上面的fread 类似,除了在这个测试中被读文件是最近才刚被读过。这将导致更高的性能,因为操作系统缓存了文件数据。Frewrite——测试调用库函数fwrite()来写文件的性能。这是一个执行缓存与阻塞写操作的库例程。缓存在用户空间之内。如果一个应用程序想要写很小的传输块,fwrite()函数中的缓存与阻塞I/O功能能通过减少实际操作系统调用并在操作系统调用时增加传输块的大小来增强应用程序的性能。 2. IOzone参数介绍

接下来解释每个参数的用法。

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替代。 -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可以在一个库中实现,而不需要 更改程序内模。 This technique is used by applications so that the async I/O may be performed in a library and requires no changes to the applications internal model. -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 # Set the lower limit on number of processes to run. When running throughput tests this option allows the user to specify the least number of processes or threads to start. This option should be used in conjunction with the -u option. -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 3. 10 个 IOZone 示例 3.1 使用默认值运行所有 IOZone 测试

-a 选项代表自动模式。这会创建大小从 64k 到 512MB 的临时测试文件,用于性能测试。此模式还使用 4k 到 16M 的记录大小进行读写(稍后会详细介绍)测试。

-a 选项还将执行所有 13 种类型的测试。

$ ./iozone -a

iozone 输出的第一组包含标题信息,其中显示有关 iozone 实用程序的信息,以及用于生成此报告的所有 iozone 选项,如下所示。

Iozone: Performance Test of File I/O Version $Revision: 3.394 $ Compiled for 32 bit mode. Build: linux Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins Al Slater, Scott Rhine, Mike Wisner, Ken Goss Run began: Wed Jan 1 01:49:26 2020 Auto Mode Command line used: ./iozone -a Output is in Kbytes/sec Time Resolution = 0.000001 seconds. Processor cache size set to 1024 Kbytes. Processor cache line size set to 32 bytes. File stride size set to 17 * record size.

输出的第二部分包含各种测试的输出值(以每秒为单位)。

第 1 列 KB:表示用于测试的文件大小。第 2 列 reclen:表示用于测试的记录长度。直到最后一列的第 3 列:表示执行的各种测试及其每秒输出值。 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 4 495678 152376 1824993 2065601 2204215 875739 582008 971435 667351 383106 363588 566583 889465 64 8 507650 528611 1051124 1563289 2071399 1084570 1332702 1143842 2138827 1066172 1141145 1303442 2004783 64 16 587283 1526887 2560897 2778775 2366545 1122734 1254016 593214 1776132 463919 1783085 3214531 3057782 64 32 552203 402223 1121909 1388380 1162129 415722 666360 1163351 1637488 1876728 1685359 673798 2466145 64 64 551580 1122912 2895401 4911206 2782966 1734491 1825933 1206983 2901728 1207235 1781889 2133506 2780559 128 4 587259 1525366 1801559 3366950 1600898 1391307 1348096 547193 666360 458907 1486461 1831301 1998737 128 8 292218 1175381 1966197 3451829 2165599 1601619 1232122 1291619 3273329 1827104 1162858 1663987 1937151 128 16 650008 510099 4120180 4003449 2508627 1727493 1560181 1307583 2203579 1229980 603804 1911004 2669183 128 32 703200 1802599 2842966 2974289 2777020 1331977 3279734 1347551 1152291 684197 722704 907518 2466350 128 64 848280 1294308 2288112 1377038 1345725 659686 1997031 1439349 2903100 1267322 1968355 2560063 1506623 128 128 902120 551579 1305206 4727881 3046261 1405509 1802090 1085124 3649539 2066688 1423514 2609286 3039423 ... 3.2 使用 iozone -b 将输出保存到电子表格

要将 iozone 输出保存到电子表格,请使用 -b 选项,如下所示。-b 代表二进制,它指示 iozone 以二进制格式将测试输出写入电子表格。

$ ./iozone -a -b output.xls

注意:-b 选项可以与下面提到的任何示例一起使用。

从电子表格中保存的数据中,可以使用电子表格工具的图形功能创建一些漂亮的图形。以下是从 iozone 输出创建的示例图。 在这里插入图片描述

3.3 使用 iozone -i 仅运行特定类型的测试

测试类型是一个数值。以下是各种可用的测试类型及其数值。

0=write/rewrite1=read/re-read2=random-read/write3=Read-backwards4=Re-write-record5=stride-read6=fwrite/re-fwrite7=fread/Re-fread,8=random mix9=pwrite/Re-pwrite10=pread/Re-pread11=pwritev/Re-pwritev12=preadv/Re-preadv

以下示例将仅运行写入测试(即写入和重写)。正如从输出中看到的,其他列是空的。

$ ./iozone -a -i 0 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 4 353666 680969 64 8 477269 744768 64 16 429574 326442 64 32 557029 942148 64 64 680844 633214 128 4 187138 524591

结合多种 iozone 测试类型

还可以通过在命令行中指定多个 -i 来组合多种测试类型。

例如,以下示例将测试读取和写入测试类型。

$ ./iozone -a -i 0 -i 1 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 4 372112 407456 1520085 889086 64 8 385574 743960 3364024 2553333 64 16 496011 397459 3748273 1330586 64 32 499600 876631 2459558 4270078 3.4 使用 iozone -s 指定文件大小

默认情况下,iozone 会自动创建大小从 64k 到 512M 的临时文件,以执行各种测试。

iozone 输出中的第一列(带有列标题 KB)表示文件大小。正如从之前的输出中看到的,它从 64KB 文件开始,并且会不断增加直到 512M(每次文件大小都翻倍)。

可以使用选项 -s 指定文件大小,而不是对所有文件大小运行测试。

以下示例将只对文件大小为 1MB(即 1024KB)的文件执行写入测试。

$ ./iozone -a -i 0 -s 1024 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 1024 4 469710 785882 1024 8 593621 1055581 1024 16 745286 1110539 1024 32 610585 1030184 1024 64 929225 1590130 1024 128 1009859 1672930 1024 256 1042711 2039603 1024 512 941942 1931895 1024 1024 1039504 706167 3.5 使用 iozone -r 指定测试的记录大小

当运行测试时,对于特定的文件大小,它会使用从 4k 到 16M 的不同记录大小进行测试。

如果您喜欢对托管 oracle 数据库的 I/O 子系统进行 I/O 性能测试,您可能希望将 iozone 中的记录大小设置为与 DB 块大小相同的值。数据库根据 DB 块大小进行读写。

reclen 代表记录长度。在前面的示例中,第 2 列(列标题为“reclen”)表示应该用于测试 IOzone 的记录长度。在前面的示例输出中,对于 1024KB 的文件大小,iozone 测试使用从 4k 到 16M 的各种记录大小来执行写入测试。

除了使用所有这些默认记录长度大小外,您还可以指定要测试的记录大小。

下面的示例将仅对 32k 的记录长度运行写入测试。在输出中,第二列现在将只显示 32。

$ ./iozone -a -i 0 -r 32 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 32 566551 820553 128 32 574098 1000000 256 32 826044 948043 512 32 801282 1560624 1024 32 859116 528901 2048 32 881206 1423096 3.5 使用 iozone -r 指定测试的记录大小

当您运行测试时,对于特定的文件大小,它会使用从 4k 到 16M 的不同记录大小进行测试。

如果您喜欢对托管 oracle 数据库的 I/O 子系统进行 I/O 性能测试,您可能希望将 iozone 中的记录大小设置为与 DB 块大小相同的值。数据库根据 DB 块大小进行读写。

reclen 代表记录长度。在前面的示例中,第 2 列(列标题为“reclen”)表示应该用于测试 IOzone 的记录长度。在前面的示例输出中,对于 1024KB 的文件大小,iozone 测试使用从 4k 到 16M 的各种记录大小来执行写入测试。

除了使用所有这些默认记录长度大小外,您还可以指定要测试的记录大小。

下面的示例将仅对 32k 的记录长度运行写入测试。在输出中,第二列现在将只显示 32。

$ ./iozone -a -i 0 -r 32 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 32 566551 820553 128 32 574098 1000000 256 32 826044 948043 512 32 801282 1560624 1024 32 859116 528901 2048 32 881206 1423096 3.6 结合文件大小和记录大小

您还可以同时使用 -s 和 -r 选项来指定确切的临时文件大小和需要测试的确切记录长度。

比如下面会使用一个2M的文件,记录长度为1M的运行写测试

$ ./iozone -a -i 0 -s 2048 -r 1024 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 2048 1024 1065570 1871841 3.7 使用 iozone -t 进行吞吐量测试

要在吞吐量模式下执行 iozone,请使用 -t 选项。您还应该指定在此测试期间需要处于活动状态的线程数。

以下示例将使用 2 个线程对写入执行 iozone 吞吐量测试。请注意,您不能将 -a 选项与 -t 选项结合使用。

$ ./iozone -i 0 -t 2 Children see throughput for 2 initial writers 1= 433194.53 KB/sec Parent sees throughput for 2 initial writers = 7372.12 KB/sec Min throughput per process = 0.00 KB/sec Max throughput per process = 433194.53 KB/sec Avg throughput per process = 216597.27 KB/sec Min xfer = 0.00 KB Children see throughput for 2 rewriters = 459924.70 KB/sec Parent sees throughput for 2 rewriters = 13049.40 KB/sec Min throughput per process = 225610.86 KB/sec Max throughput per process = 234313.84 KB/sec Avg throughput per process = 229962.35 KB/sec Min xfer = 488.00 KB

要为所有测试类型执行吞吐量,请从上面的示例中删除“-i 0”,如下所示。

$ ./iozone -t 2 3.8 使用 iozone -+u 包含 CPU 使用率

在执行 iozone 测试时,您还可以使用 -+u 选项指示 iozone 收集 CPU 利用率。

选项前面的 -+ 可能看起来有点奇怪。但是,您必须给出整个 -+u(不仅仅是 -u 或 +u)才能使其正常工作。

以下示例将执行所有测试,并将 CPU 利用率报告作为它生成的 Excel 电子表格输出的一部分。

$ ./iozone -a -+u -b output.xls

注意:这将为它执行的每个测试显示单独的 CPU 利用率。

3.9 使用 iozone -g 增加文件大小

这个很重要。如果您的系统有超过 512MB 的 RAM,您应该增加 iozone 用于测试的临时文件大小。如果不这样做,您可能无法获得准确的结果,因为系统缓冲区缓存将在其中发挥作用。

为了获得准确的磁盘性能,建议将临时文件大小设置为系统缓冲区缓存大小的 3 倍。

以下示例将通过将最大文件大小增加到 2GB 来运行 iozone,并为写入测试运行自动 iozone 测试。

$ ./iozone -a -g 2G -i 0 random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread 64 4 556674 1230677 64 8 278340 441320 64 16 608990 1454053 64 32 504125 1085411 64 64 571418 1279331 128 4 526602 961764 128 8 714730 518219 ... 3.10 使用 iozone -F 一起测试多个挂载点

通过组合几个 iozone 选项,您可以在多个挂载点上执行磁盘 I/O 测试,如下所示。

如果您有 2 个挂载点,则可以启动 2 个不同的 iozone 线程以在这两个挂载点上创建临时文件以进行测试,如下所示。

$ ./iozone -l 2 -u 2 -r 16k -s 512M -F /u01/tmp1 /u02/tmp2 -l 表示应该启动的最小iozone进程数-u 表示应该启动的最大iozone进程数-F 应该包含多个值。即如果我们在 -l 和 -u 中都指定 2,我们应该在这里有两个文件名。请注意,只有挂载点需要存在。-F 选项中指定的文件不需要存在,因为 iozone 将在测试期间创建此临时文件。在上面的示例中,挂载点是 /u01 和 /u02。文件 tmp1 和 tmp2 将由 iozone 自动创建用于测试目的。


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有