用bonnie++测试磁盘I/O

bonnie++是一款开源的磁盘I/O测试的工具。我们可以用它来测试磁盘和文件系统的I/O性能。


一、下载安装
下载地址是:http://www.coker.com.au/bonnie++/
目前正式发布的最新版本是bonnie++-1.03a
你也可以在下面的地址下载更新的版本,但这些版本是试验版本,可能会存在问题。http://www.coker.com.au/bonnie++/experimental/
下载后需要编译安装。过程如下:
[root@test src]# tar zxvf bonnie++-1.03a.gz
bonnie++-1.03a/
bonnie++-1.03a/sun/
bonnie++-1.03a/sun/Makefile
bonnie++-1.03a/sun/pkginfo.in
bonnie++-1.03a/sun/pkginfo
bonnie++-1.03a/sun/prototype
bonnie++-1.03a/semaphore.cpp
bonnie++-1.03a/bon_suid.cpp
bonnie++-1.03a/Makefile
bonnie++-1.03a/bon_csv2html.1
bonnie++-1.03a/bon_file.h
bonnie++-1.03a/bon_csv2html.in
bonnie++-1.03a/conf.h.in
bonnie++-1.03a/bon_io.cpp
bonnie++-1.03a/bonnie++.spec
bonnie++-1.03a/configure
bonnie++-1.03a/bon_csv2html
bonnie++-1.03a/bon_csv2txt.in
bonnie++-1.03a/bon_time.h
bonnie++-1.03a/semaphore.h
bonnie++-1.03a/configure.in
bonnie++-1.03a/bonnie++.8
bonnie++-1.03a/forkit.h
bonnie++-1.03a/credits.txt
bonnie++-1.03a/bonnie++.spec.in
bonnie++-1.03a/install.sh
bonnie++-1.03a/changelog.txt
bonnie++-1.03a/bonnie++.cpp
bonnie++-1.03a/forkit.cpp
bonnie++-1.03a/zcav.cpp
bonnie++-1.03a/port.h.in
bonnie++-1.03a/debian/
bonnie++-1.03a/debian/dirs
bonnie++-1.03a/debian/docs
bonnie++-1.03a/debian/control
bonnie++-1.03a/debian/rules
bonnie++-1.03a/debian/changelog
bonnie++-1.03a/debian/copyright
bonnie++-1.03a/conf.h
bonnie++-1.03a/bon_file.cpp
bonnie++-1.03a/Makefile.in
bonnie++-1.03a/bon_csv2txt.1
bonnie++-1.03a/bonnie.h.in
bonnie++-1.03a/port.h
bonnie++-1.03a/zcav.8
bonnie++-1.03a/copyright.txt
bonnie++-1.03a/sh.common
bonnie++-1.03a/bon_io.h
bonnie++-1.03a/bonnie.8
bonnie++-1.03a/bonnie.h
bonnie++-1.03a/bon_csv2txt
bonnie++-1.03a/bon_time.cpp
bonnie++-1.03a/readme.html

[root@test bonnie++-1.03a]# make
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c bon_io.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c bon_file.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c bon_time.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c semaphore.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c forkit.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -c bon_suid.cpp
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope bonnie++.cpp -o bonnie++ bon_io.o bon_file.o bon_time.o semaphore.o forkit.o bon_suid.o
bonnie++.cpp: In function `void ctrl_c_handler(int, siginfo_t*, void*)':
bonnie++.cpp:142: warning: unused parameter `int sig'
bonnie++.cpp:142: warning: unused parameter `void*unused'
g++ -O2 -DNDEBUG -Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope zcav.cpp -o zcav bon_suid.o
[root@test bonnie++-1.03a]# ls
bon_csv2html bon_file.h bonnie++.8 bon_suid.o config.log forkit.cpp port.h.in zcav
bon_csv2html.1 bon_file.o bonnie++.cpp bon_time.cpp config.status forkit.h readme.html zcav.8
bon_csv2html.in bon_io.cpp bonnie.h bon_time.h configure forkit.o semaphore.cpp zcav.cpp
bon_csv2txt bon_io.h bonnie.h.in bon_time.o configure.in install.sh semaphore.h
bon_csv2txt.1 bon_io.o bonnie++.spec changelog.txt copyright.txt Makefile semaphore.o
bon_csv2txt.in bonnie++ bonnie++.spec.in conf.h credits.txt Makefile.in sh.common
bon_file.cpp bonnie.8 bon_suid.cpp conf.h.in debian port.h sun

二、使用说明
[root@test bonnie++-1.03a]# ./bonnie++
You must use the "-u" switch when running as root.
usage: bonnie++ [-d scratch-dir] [-s size(Mb)[:chunk-size(b)]]
[-n number-to-stat[:max-size[:min-size][:num-directories]]]
[-m machine-name]
[-r ram-size-in-Mb]
[-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use]
[-q] [-f] [-b] [-p processes | -y]

Version: 1.03
-d:在测试时会生成一些文件,并读或更改这些文件。这个参数是设置测试文件放置的路径。
-s:单个测试文件的尺寸。这个参数值必须大于等于2倍测试使用的内存(最好为测试使用内存的两倍)。测试时应该用大文件尺寸。
-m:测试的机器名称
-r:测试需要用多少内存。如果省略这个值,则会用全部的物理内存。
-x:循环几次
-u:指定执行测试的OS用户。当以root执行时,必须显式指定。

三、实例测试

下面是在一个普通PC上的测试过程和结果:

[root@test bonnie++-1.03a]# ./bonnie++ -d /test -s 1000 -u root
Using uid:0, gid:0.
File size should be double RAM for good results, RAM is 1000M.
[root@test bonnie++-1.03a]# ./bonnie++ -d /test -s 2000 -u root
Using uid:0, gid:0.
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
Delete files in sequential order...done.
Create files in random order...done.
Stat files in random order...done.
Delete files in random order...done.
Version 1.03 ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
test 2000M 18765 47 29007 6 12849 3 11894 27 12196 1 67.0 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 912 31 +++++ +++ +++++ +++ 2910 98 +++++ +++ 12508 95
test,2000M,18765,47,29007,6,12849,3,11894,27,12196,1,67.0,0,16,912,31,+++++,+++,+++++,+++,2910,98,+++++,+++,12508,95

Sequential Output部分表示写文件的相关信息
Sequential Input部分表示读文件的相关信息
Per Chr表示以字符为单位读写文件
Block表示以block为单位读写文件
Rewrite表示修改并重写已经存在的文件的每一个block
K/sec表示每秒读或写文件的速率,以K为单位
%CP表示在某阶段执行操作时平均消耗的CPU

可以看到,该机器(普通PC)的字符写速度可达18765K/sec,block写速度可达29007K/sec,
字符读速度可达11894K/sec,block读速度可达12196K/sec

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-63733/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/231499/viewspace-63733/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值