Thursday, September 12, 2013

Bits and pieces about Bonnie++

Bonnie++ is a tool to test file systems under Linux.
It create / read / delete files, so the performance is of file system but not the disk (block device).
These are some bits and pieces of using Bonnie++.
It's not written to be used as manpage, so refer to it if in doubt or missing info ;)

Install:
On RH-like platforms, simply add EPEL repository and yum it.
Debian / Ubuntu should have it in APT ;)

Usage: (these are not complete parameters, check manpage)
bonnie++ [-d scratch-dir] [-s size(MiB)] [-n number-to-stat[:max-size[:min-size][:num-directories]]] [-m comment] [-r ram-size-in-MiB] [-u uid-to-use] [-f]

There's some pieces missing on manpage.

-d sets the scratch directory location.
Run without one uses the current working directory.

-s sets the test file size for single large file operation test.
The size can use postfix of m / g.
Using size 0 skips this test.

-r limits the RAM size used by bonnie++.
The memory acts as read cache, so generally we set the size (above) at least twice of memory size to fill the cache.
But sometimes you just have too much memory (lol) and the test takes forever.
You can then ask Bonnie++ to use less but not all memory for the test.
Setting this, however, risks getting read result too high.

-n the fun part of Bonnie++.
Invoking this flag enables multiple file test.
The file number is actully multiples of k, so write 1 actually means 1024 files, while default to 16k.
The essence of this test is the file size.
When omitted (default), the max and min file size are set to 0, so you're creating / deleting many 0-sized files.
You can also assign min and max file size; this is particularity useful to simulate real-world scenario.
For example:
-n 4:100k
means creating 4k files, size range from 100k to 0 (Bonnie++ will set each file size randomly in the range).
You can also assign the same value for max and min size, so only one size is used.
Note that the result is shown in "files / sec", so you'll have to multiply it with the (average) file size to get MB/s data.

-u assign the user to run Bonnie++, set it by your scratch directory permission.

-m set a comment that will shown in the result.

-f skips the by-character oprtation test. Invoke it when this test is not needed or you're in hurry ;)

No comments: