How to Install/Test Linux Filesystem Performance with Bonnie++

Today I will show you how to install and use Bonnie++, a free file system performance testing tool for Linux and Unix-like operating systems. It is a test suite that is aimed at performing a number of simple tests on hard drive and file system performance. It allows you to test how your file systems perform with respect to data read and write speed, the number of seeks that can be performed per second and the number of file metadata operations that can be performed per second.

Install Bonnie++

Bonnie++ is available in the Ubuntu repository, so you can use the package installer to get it, type:

# apt-get install bonnie++

If your Linux distribution doesn't have the package in its application manager you can install it from source by going to Bonnie++ website and downloading the source code archive. After that you can install it by running the traditional "./configure", "make", "make install" like so:

# wget
# tar zxvf bonnie++-1.03e.tgz
# cd bonnie++-1.03e.tgz
# ./configure
# make
# make install

Testing file system and hard drive performance

Important Note: Before starting you should NEVER run this program on a live server or a production environment since it will mostly drive the hard disk to the limit services will most likely be available. Be sure to schedule a maintenance period where you can run this tests without causing important services to become unusable.

Running the test is simple, you just have to run the command:

$ bonnie++

The first part of the tests consists of types of filesystem activity that have been observed to be bottlenecks in I/O-intensive applications. It initially performs a series of tests on a file of known size. For each test, Bonnie reports the number of Kilo-bytes processed per elapsed second and the % CPU usage. The next tests involve file create/stat/unlink to simulate some operations that are common bottlenecks on large Squid and INN servers and machines with tens of thousands of mail files in /var/spool/mail.

Take note that recently the -b option was added to cause a fsync() after every write. This is what you probably want to do if testing performance of mail or database servers as they like to sync everything. The default is to allow write-back caching in the OS which is what you want if testing performance for copying files, compiling, etc.

Important flags you can use:

-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.
-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.
-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.
-x - number of test runs. This is useful if you want to perform more than one test.
-b - no write buffering. fsync() after every write.

Leave a Comment