bonnie++
参考
主页
编译安装
使用简介
iozone
参考
简介
编译安装
用法简介
使用技巧
测试模式 (-i)

bonnie++

参考

主页

http://www.coker.com.au/bonnie++/

编译安装

可以在 http://koji.fedoraproject.org/koji/packageinfo?packageID=1413 下 载针对 fedora 的 srpm 包编译。也可以从主页下载 src 自行编译。

使用简介

bonnie++

  [-d scratch-dir] 测试目录(通常我们把要测试的分区挂载在某个目录)
  [-s size(Mb) [:chunk-size(b)]] 文件大小:块大小  默认大小:300M:8K
  [-n number- to-stat [:max-size [:min-size] [:num-directories]]] 文件创建测试的文件数n*1024,最大文件大小,最小文件大小,目录数,max=-1:hard link,-2:soft link
  [-m machine-name] 机器名,仅用于显示
  [-r ram-size-in-Mb] 机器内存大小
  [-x number-of-tests] test数量
  [-u uid-to-use:gid-to-use] 测试所用的用户名:组名
  [-g gid-to-use]
  [-q] 安静模式
  [-f] 快速模式,不进行单字符IO测试
  [-b] 不使用写缓存
  [-p processes | -y] bonnie++进程数,使用信号量同步多个进程
  [-y] 每个测试开始之前等待信号量

通常的测试包括:

Writing with putc() -> Sequential Output的Per Chr
Writing intelligently -> Sequential Output的Block
Rewriting -> Sequential Output的Rewrite
Reading with getc() -> Sequential Input的Per Chr
Reading intelligently -> Sequential Input的Block
start ’em -> Random Seeks
Create files in sequential order -> Sequential Create的Create
Stat files in sequential order -> Sequential Create的Read
Delete files in sequential order -> Sequential Create的Delete
Create files in random order -> Random Create的Create
Stat files in random order -> Random Create的Read
Delete files in random order -> Random Create的Delete

而这12项结果又被分为了5大类,分别是Sequential Output(写测 试),Sequential Input(读测试),Random Seeks(读写测试),Sequential Create(顺序读写文件测试)和Random Create(随意读写文件测试)

iozone

参考

简介

主页 : http://www.iozone.org/

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

编译安装

在 iozone 主页上有一个 srpm 包,默认安装路径为 /opt/iozone/bin/iozone 。如果想自己编译,那么你应该知道自己安装到哪里了。:-)

以 iozone3_326.tar 为例:

# tar xf iozone3_326.tar
# cd iozone3_326/src/current/
# make linux

执行完 "make linux" 命令后,当前目录下生成有 iozone 等命令。

用法简介

在需要测试的文件系统上运行相应命令

iozone -a 在希望的文件系统上测试,不过只有-a的话会进行全面测试,要花费很长时间,最好用-i指定测试范围
iozone -a -i 1 只对write, rewrite进行性能测试
iozone -a -i 1 -i 0 对读写进行性能测试
iozone -a -g 1G -i 0 -i 1 对读写进行性能测试,并且最大测试文件为1G
iozone -Ra 测试所有方面,并且生成excel文件
iozone -Rab output.wks 重定向保存到另外一个文件中.
iozone -a -s 512m -y 1k -q 8k -b minfile_result.xls 测试小文件
iozone -a -s 512m -y 8k -q 512k -b comfile_result.xls 测试普通文件
iozone -a -s 512m -y 1024k -q 10240k -i 0 -i 1 -i 2 -b largefile_result.xls 测试大文件
iozone -Rab output.wks -g 1G -i 0 -i 1 -i 2 -i 8 -i的使用
-i # 后接测死模式, 0 读,1 写, ... 各种模式详见本文 "测试模式(-i)" 部分
-R 创建 Excel 报告
-g 设置自动模式下最大文件大小
-n 指定最小测试文件大小
-s 指定文件大小(-s 512k or -s 512M or -s 1G)
-f filename 指定临时文件,即测试文件名字
-F filename filename filename 指定临时文件组
-t 线程数
-C 显示每个节点的吞吐量
-c 测试包括文件的关闭时间
-r 文件块大小
-q 指定最大记录大小(-q 512K or -q 512M or -q 1g)
-y 指定最小记录大小(-y 512K or -y 512M or -y 1g)
-U mountpoint Mount point to unmount and remount between tests. Iozone will unmount and remount this mount point before beginning each test. This guarantees that the buffer cache does not contain any of the file under test.

使用技巧

用tee命令生成log信息

/opt/iozone/bin/iozone -g 2G -n 512M -i 0 -i 1 -f /data/jianlee.iozone -Rab ~/iozone.xls -C | tee ~/iozone.log

iozone的日志文件写入到了iozone.log内。

测试模式 (-i)

-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

测试格式为-i #,比如测试写:-i 0,测试读和写:-i 0 -i 1。