存储器性能测试工具 - Bonnie

上一篇 / 下一篇  2007-10-11 00:10:31 / 个人分类:存储测试工具

51Testing软件测试网2Ui-bR@{ p;[}

What Bonnie Does?

F1pw'EDQ`5OE0

%FSsB/iNoS0Bonnie performs a series of tests on a file of known size. If the size is not specified, Bonnie uses 100 Mb; but that probably isn't enough for a big modern server - you your file to be a lot bigger than the available RAM51Testing软件测试网8ht``.yVF|Be
Bonnie works with 64-bit pointers if you have them.
(PT"b M2~&}4?C%]Z0For each test, Bonnie reports the bytes processed per elapsed second, per CPU second, and the % CPU usage (user and system).
M/T2R!Hrc?J C2h0In each case, an attempt is made to keep optimizers from noticing it's all bogus. The idea is to make sure that these are real transfers between user space and the physical disk. The tests are:

Z r yXD\$z z0

%H\nS|du01. Sequential Output51Testing软件测试网tOqC(n ri

51Testing软件测试网7Q,U"y6[g1Ci

1.1 Per-Character

5z%]2TFZ@(}(Y!P'`051Testing软件测试网"r#N.Qb/Kn

The file is written using the putc() stdio macro. The loop that does the writing should be small enough to fit into any reasonable I-cache. The CPU overhead here is that required to do the stdio code plus the OS file space allocation.51Testing软件测试网5Oq} wWj

$Od^;lx KYa01.2 Block51Testing软件测试网0M Pl_M E

'RykW H UvcP0The file is created using write(2). The CPU overhead should be just the OS file space allocation.

[.OG!@E,BB0a3A!J k0

I"X)D7e;iZ1i7Py01.3 Rewrite51Testing软件测试网%k}gr1E8U9P

51Testing软件测试网 e%k#M*}Tq{7O~w

Each Chunk (currently, the size is 16384) of the file is read with read(2), dirtied, and rewritten with write(2), requiring an lseek(2). Since no space allocation is done, and the I/O is well-localized, this should test the effectiveness of the filesystem cache and the speed of data transfer.51Testing软件测试网'L4DPS9]H0_yY!O e+Dq

51Testing软件测试网 R0W%YN~4_2m]

2. Sequential Input

_2} XqB6gK+SK051Testing软件测试网t+NM8sPLl2b`,e H

2.1 Per-Character51Testing软件测试网:uuWP-z*r;c;{-{9A4_

51Testing软件测试网/lGSEKr[1Q

The file is read using the getc() stdio macro. Once again, the inner loop is small. This should exercise only stdio and sequential input.

0l rY W qe0

B8U5dHK02.2 Block51Testing软件测试网-V#G+?E(RU~

%ToT`0{T0The file is read using read(2). This should be a very pure test of sequential input performance.

R9T vc?051Testing软件测试网-|$tuLJ!?"FY

3. Random Seeks51Testing软件测试网3c!PM q'z+H6r

51Testing软件测试网X8\ TN'qTl;jQ5}

This test runs SeekProcCount (currently 4) processes in parallel, doing a total of 4000 lseek()s to locations in the file computed using by random() in bsd systems, drand48() on sysV systems. In each case, the block is read with read(2). In 10% of cases, it is dirtied and written back with write(2).

7Q%M;fU!L\eca#pN0

eaFw4c T8_jT.K.N0The idea behind the SeekProcCount processes is to make sure there's always a seek queued up.51Testing软件测试网Dz$s9KW4o6V

51Testing软件测试网~;t5` qw,D

AXIOM: For any unix filesystem, the effective number of lseek(2) calls per second declines asymptotically to near 30, once the effect of caching is defeated. [ I wrote the previous sentence in about 1988, and it's a bit better now, but not much ]

,|L$t;@6T9R]P051Testing软件测试网q7va F"G.p0F!J

The size of the file has a strong nonlinear effect on the results of this test. Many Unix systems that have the memory available will make aggressive efforts to cache the whole thing, and report random I/O rates in the thousands per second, which is ridiculous. As an extreme example, an IBM RISC 6000 with 64 Mb of memory reported 3,722 per second on a 50 Mb file. Some have argued that bypassing the cache is artificial since the cache is just doing what it's designed to. True, but in any application that requires rapid random access to file(s) significantly larger than main memory which is running on a system which is doing significant other work, the caches will inevitably max out. There is a hard limit hiding behind the cache which has been observed by the author to be of significant import in many situations - what we are trying to do here is measure that number.

f-auSd:T4zY!Ce0

q3TZ7D*b/zt_oz0The Bonnie Command Line

R+F wP$lA%@051Testing软件测试网Q&tN/}`Gv5bP d

The Bonnie command line, given here in Unix style, is:51Testing软件测试网+~4o;g/t5^$zD

51Testing软件测试网-ie c1rs-{.eD ^

Bonnie [-d scratch-dir] [-s size-in-Mb] [-m machine-label] [-html]51Testing软件测试网?;uE9P7i&]:y\'R

51Testing软件测试网~/daTX/pf;V

All the things enclosed in square brackets may be left out. The meaning of the things on this line is:51Testing软件测试网v8N D0xF^@:H;~

51Testing软件测试网Mb m.wte;`4a*i

Bonnie
M0ap^L0
The name of the program. You might want to give it a different name. If you are sitting in the same directory as the program, you might have to use something like ./Bonnie.
Yn'B:B"`D$A%p]r0-d scratch-dir
m4}bYY }uS/f0
The name of a directory; Bonnie will write and read scratch files in this directory. Bonnie does not do any special interpretation of the directory name, simply uses it as given. Suppose you used -d /raid1/TestDisk; Bonnie would write, then read back, a file whose name was something like /raid1/TestDisk/Bonnie.34251.
F cs|(A"N0If you do not use this option, Bonnie will write to and read from a file in the current directory, using a name something like ./Bonnie.35152.
&]DF2dBZ0Bonnie does clean up by removing the file after using it; however, if Bonnie dies in the middle of a run, it is quite likely that a (potentially very large) file will be left behind.51Testing软件测试网yj6P#i*Kp8WA
-s size-in-Mb
UO2^5N;? c0
The number of megabytes to test with. If you do not use this, Bonnie will test with a 100Mb file. In this discussion, Megabyte means 1048576 bytes. If you have a computer that does not allow 64-bit files, the maximum value you can use is 2047.51Testing软件测试网Hl7ZH:do
It is important to use a file size that is several times the size of the available memory (RAM) - otherwise, the operating system will cache large parts of the file, and Bonnie will end up doing very little I/O. At least four times the size of the available memory is desirable.51Testing软件测试网 v5Q$NxQn
-m machine-label
9A7M:t[O0This is the label that Bonnie will use to label its report. If you do not use this, Bonnie will use no label at all.
)z)H J-fC3PeVw0-html51Testing软件测试网nAVZx0V^
If you use this, Bonnie will generate a report in HTML form, as opposed to plain text. This is not all that useful unless you are prepared to write a table header.51Testing软件测试网7r"ExL)\#F)qU;}n

N?!V^7n.]'R0Bonnie Results

"F(lj];I5O0

.h+F-eP v)y1] ]P0Before explaining each of the numbers, it should be noted that the columns below labeled %CPU may be misleading on multiprocessor systems. This percentage is computed by taking the total CPU time reported for the operation, and dividing that by the total elapsed time. On a multi-CPU system, it is very likely that application code and filesystem code may be executing on different systems. On the final test (random seeks), the parent process creates four child processes to perform the seeks in parallel; if there are multiple CPUs it is nearly certain that all will be involved. Thus, these numbers should be taken as a general indicator of the efficiency of the operation relative to the speed of a unit unit CPU. Taken literally, this could make a machine with 10 50-horsepower CPUs appear less efficient than one with one 100-horsepower CPU.51Testing软件测试网(f7Lq;]}c/j%T

51Testing软件测试网#w8Hg`PwW

Here is an example of some typical Bonnie output:51Testing软件测试网7oP l;u*FaQP

51Testing软件测试网i,BB3WQan?

              -------Sequential Output-------- ---Sequential Input-- --Random--51Testing软件测试网 b8b | oZ\
              -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks---51Testing软件测试网u4b.yGD2K{+}n0Z
Machine    MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU  /sec %CPU
:n c ~8g3F$SS5a0mystery   750   534 65.7  1236 22.5   419 17.5   564 74.3  1534 32.8  35.0  8.3

#_H$H0FGho0c"P051Testing软件测试网hz#D Ju8@S

Download URL51Testing软件测试网 vB2F3p4Ih

51Testing软件测试网Iepk'wu@

Official Site:http://www.textuality.com/bonnie/download.html51Testing软件测试网'V[2hb3b7s+dn `jEp{
51Testing软件测试网 D'Ki:M \g8rp$c-B


TAG: 性能测试 存储测试工具 存储测试 Bonnie

 

评分:0

我来说两句

Open Toolbar