bonnie++

How to install bonnie++

  1. Download bonnie++ tarball from http://www.coker.com.au/bonnie++/

  2. Extract and install it:

    1
    2
    3
    # tar -xvzf bonnie++-XXX.tgz
    # cd bonnie++-XXX
    # make

Features and Functions

  • Easy to use, a simple tool used to test your hard drive and file system performance.
  • Can test the following I/O operations:
    • Sequential Output
      • Per Chr
      • Block
      • Rewrite
    • Sequential Input
      • Per Chr
      • Block
    • Random
      • Seeks
    • Sequential Create
      • Create
      • Read
      • Delete
    • Random Create
      • Create
      • Read
      • Delete

Bonnie++ is a program to test hard drives and file systems for performance or the lack therof. There are a many different types of file system operations which different applications use to different degrees. Bonnie++ tests some of them and for each test gives a result of the amount of work done per second and the percentage of CPU time this took. For performance results higher numbers are better, for CPU usage lower are better (NB a configuration scoring a performance result of 2000 and a CPU result of 90% is better in terms of CPU use than a configuration delivering performance of 1000 and CPU usage of 60%).

There are two sections to the program’s operations. The first is to test the IO throughput in a fashion that is designed to simulate some types of database applications. The second is to test creation, reading, and deleting many small files in a fashion similar to the usage patterns of programs such as Squid or INN.

How to use bonnie++

Just issue the following command, it should be ok for most situations:

1
# bonnie++ -d /testdir/ -m testname -u root -s $((2*$RAM_SIZE))

Note:
If you test want to test hard drive, you must mount it to the value of -d option. Also make sure that the hard drive size is double RAM, or you will have to specify -r option.

If you want to reduce ‘++++’ you need to increase the test time either by increasing the value of -n or by increasing the value of -s.

Results analysis

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# bonnie++ -d ./ -m testname -u root -s 40M -r 10M
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.03e ------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
testname 40M 54715 99 +++++ +++ +++++ +++ 51914 99 +++++ +++ +++++ +++
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 15104 99 +++++ +++ +++++ +++ 15480 99 +++++ +++ 31050 95
testname,40M,54715,99,+++++,+++,+++++,+++,51914,99,+++++,+++,+++++,+++,16,15104,99,+++++,+++,+++++,+++,15480,99,+++++,+++,31050,95

The primary output is plain-text in 80 columns which is designed to fit well when pasted into email and which will work well with Braille displays.

The second type of output is CSV (Comma Seperated Values). This can easily be imported into any spread-sheet or database program. Also it have included the programs bon_csv2html and bon_csv2txt to convert CSV data to HTML and plain-ascii respectively:

  1. Select the last comma seperated line.

  2. Run the following command to generate the html file:

    1
    echo 'testname,40M,54715,99,+++++,+++,+++++,+++,51914,99,+++++,+++,+++++,+++,16,15104,99,+++++,+++,+++++,+++,15480,99,+++++,+++,31050,95' | perl bon_csv2html > results.html

For every test two numbers are reported, the amount of work done (higher numbers are better) and the percentage of CPU time taken to perform the work (lower numbers are better). If a test completes in less than 500ms then the output will be displayed as “++++”. This is because such a test result can’t be calculated accurately due to rounding errors and I would rather display no result than a wrong result.

The main parameters

  • -d - the directory to use for the tests.
  • -s - the size of the file(s) for IO performance measures in megabytes. If the size is greater than 1G then multiple files will be used to store the data, and each file will be up to 1G in size. This parameter may include the chunk size seperated from the size by a colon. The chunk-size is measured in bytes and must be a power of two from 256 to 1048576, the default is 8192. You can specify the size in giga-bytes or the chunk-size in kilo-bytes if you add g or k to the end of the number respectively.
  • -r - RAM size in megabytes. If you specify this the other parameters will be checked to ensure they make sense for a machine of that much RAM. You should not need to do this in general use as it should be able to discover the RAM size. NB If you specify a size of 0 then all checks will be disabled…
  • -b - no write buffering. fsync() after every write.
  • -D - use direct IO (O_DIRECT) for the bulk IO tests.
  • -n - the number of files for the file creation test. This is measured in multiples of 1024 files. This is because no-one will want to test less than 1024 files, and we need the extra space on braille displays.
  • -x - number of test runs. This is useful if you want to perform more than one test. It will dump output continuously in CSV format until either the number of tests have been completed, or it is killed.
  • -m - name of the machine - for display purposes only.
  • -f - fast mode, skips per-char IO tests
  • -u - user-id to use. When running as root specify the UID to use for the tests. It is not recommended to use root (since the occasion when a Bonnie++ bug wiped out someone’s system), so if you really want to run as root then use -u root. Also if you want to specify the group to run as then use the user:group format. If you specify a user by name but no group then the primary group of that user will be chosen. If you specify a user by number and no group then the group will be nogroup.
  • -g - group-id to use. Same as using:group for the -u parameter, just a different way to specify it for compatibility with other programs.
  • -q - quiet mode. If specified then some of the extra informational messages will be suppressed.

Reference