300 IBM TotalStorage DS6000 Series: Performance Monitoring and Tuning
granularity in kilobytes. Note that this must be a power of 2, and that the coarsest granularity
is 128 kilobytes.
8.6 Bonnie
Bonnie is a performance measurement tool written by Tim Bray. For a more complete
description and documentation on Bonnie go to the following Web site:
http://www.textuality.com/bonnie/
Bonnie performs a series of tests on a file of known size. If the size is not specified, Bonnie
uses 100 Mb, but that probably is not enough for a big modern server. Bonnie works with
64-bit pointers if you have them.
For each test, Bonnie reports the bytes processed per elapsed second, per CPU second, and
the % CPU usage (user and system).
8.6.1 Benchmarks
Bonnie does the following benchmarks:
char output with put() / putc_unlocked()
The result is the performance a program will see that uses putc() to write single
characters. On most systems, the speed for this is limited by the overhead of the library
calls into the libc, not by the underlying device. The _unlocked version (used if bonnie is
called with -u) may be considerably faster, as it involves less overhead.
char input with getc() / getc_unlocked()
The result is the performance a program will see that uses getc() to read single characters.
The same comments apply as to putc().
Block output with write()
This is the speed with which your program can output data to the underlying file system
and device writing blocks to a file with write(). As writes are buffered on most systems, you
will see numbers that are much higher than the actual speed of your device, unless you
sync() after the writes (option -y) or use a considerably larger size for your test file than
your OS will buffer. For Linux, this is almost all your main memory.
If called with the -o_direct option, this operation (and the ones described in the following
two paragraphs) is done with the O_DIRECT flag set, which results in direct DMA from
your hardware to userspace, thus avoiding CPU overhead copying buffers around. This
will prevent buffering, and gives a much better estimate of real hardware speed, also for
small test sizes.
Block input with read()
This is the speed with which you can read blocks of data from a file with read(). The same
comment as for block output regarding your OS doing buffering for you applies, with the
exception that using -y does not help to get realistic numbers for reading. You would need
to flush the buffers of the underlying block device, but this turns out to not be trivial, as you
first have to find out the block device. It would be a Linux-only feature anyway.
Block in/out rewrite
Bonnie does a read(), changes a few bytes, write()s the data back and reread()s it. This is
a pattern that occurs on some database applications. Its result tells you how your
operating root (/) file system can handle such access patterns.