LINUX - Benchmark Storage with BONNIE

RUNNING BONNIE++ 
##################

INTRO
=========
* Benchmark program 
* Be root 
* Dont run commands with # in the front of them they are for explanation purposes
* This article shows how to do local test with it
* This article shows how to use the Beta version @ time of writing article 6/16/2013 latest beta was: 1.97 and latest stable is 1.03e - just so you are aware the install instructions are absolutely the same for both

GOOD LINKS/ARTICLES:
======================
http://www.coker.com.au/bonnie++/  #<--- where you find the latest of beta and stable versions
http://archive09.linux.com/feature/139742
http://www.googlux.com/bonnie.html
http://ronaldbradford.com/mysql-expert/cheatsheets/using-bonnie++.htm


THE ARTICLE
============

cd /kossboss
mkdir test # <-- this folder will have 10 to 20 times amount of ram available to it
mkdir bonnie
chmod -R 777 /kossboss # <--- prepares everything to be runnable by other users, you will see why
cd /kossboss/bonnie
wget http://www.coker.com.au/bonnie++/experimental/bonnie++-1.97.tgz
tar -xzvf bonnie++-1.97.tgz
cd /kossboss/bonnie/bonnie++-1.97.1
./configure

* You have 2 choices, do  make followed by make install or just make without install.
* Make will compile it to the current directory but will not make it executable through our your PATH directories, but you will always have to run it from that current directory /kossboss/bonnie/bonnie++-1.97.1/

if you choose to make install it 
====================================
* this will spread the program through our your filesystem bin directories
make
make install # <-- you have a choice to do this or not

if you choose to not make install
==================================
* As an optional step since you didnt do make install, you can set the path for bonnie, that way you can call upon bonnie without the directory

EXAMPLE WITH PATH:
-------------------
PATH=./bonnie++-1.03e:$PATH;export PATH
* You then can run it like this from any directory:
# bonnie++ -r 4096 -s 81920 -d /u01/tmp -f -b -n 1
* or if you want nohup:
# nohup bonnie++ -r 4096 -s 81920 -d /u01/tmp -f -b -n 1 &


WITHOUT PATH:
--------------
* You will have to specify full path from any directory:
# /kossboss/bonnie/bonnie++-1.03e/bonnie++ -r 4096 -s 81920 -d /u01/tmp -f -b -n 1
* or if you want nohup:
#  nohup /kossboss/bonnie/bonnie++-1.03e/bonnie++ -r 4096 -s 81920 -d /u01/tmp -f -b -n 1 &
* Or you can cd into the directory /kossboss/bonnie/bonnie++-1.03e/ and run it like this:
# ./bonnie++ -r 4096 -s 81920 -d /u01/tmp -f -b -n 1

Final setup step:
==================

* In my case im going to make bonnie executable and readable for all because bonnie cant be run as root - well it can but if you run it as root you MUST specify another user using the -u parameter or else it will error out, and if you run it as another user well then you dont have to specify another user.
* Exerpt: "If you elected to run this as 'root', it is recommended you use.
-u [uid|username] is the uid to run the test with
-g [gid|group] is the gid to run the test with"
* First cd to where you have bonnie++ file
* Also the test folder into which bonnie will write and read files from needs to be accessible with a specified user

If you did a make install
---------------------------
which bonnie++
* OUTPUT:
/usr/local/sbin/bonnie++
* So I run:
chmod +x /usr/local/sbin/bonnie++
chmod +r /usr/local/sbin/bonnie++

If you didnt to make install
-------------------------------
cd /kossboss/bonnie/bonnie++-1.03e
chmod +x bonnie++
chmod +r bonnie++

Finding out info before run
=============================

* We need to specify RAM size to bonnie and a location that can handle 10 to 20 times amount of ram, all specifications will be in MB
* Find out how much ram you have (total ram, not available, and not swap)
free -m
* MY OUTPUT:
             total       used       free     shared    buffers     cached
Mem:           590        464        125          0         23        314
-/+ buffers/cache:        126        463
Swap:          634         11        623

* It says 590 MB - I know I have 613 so I will use 613 for my tests.
* Now we need a folder to test to /kossboss/test will do just fine (if you want to benchmark across the network you can make /kossboss/test be a mount of another filesystem using nfs, cifs, afp-netatalk, sshfs, whatever... in this case its just my local disk, so im not doing mount)
* Lets see if /kossboss/test can handle the test - I need to be able to fit 10 to 20 times amount of ram

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       10G  2.7G  6.9G  28% /  ---- /kossboss/test is here so I have enough room for 10 times but not 20
udev            288M   12K  288M   1% /dev
tmpfs           119M  164K  118M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            296M     0  296M   0% /run/shm

* So I conclude that I have 613 MB of Ram and my test size will be 6130MB as that will fit in /kossboss/test

* Here are the options Im going to consider:

* EXERPT:  "Some more information on the arguments used. Refer to Manual Page (also included below) for more information.
-r amount of RAM in MB
-s size of the I/O test in MB (use 10x-20x of RAM)
-d directory to run the test on
-n is the number of files for the file creation test (multiples of 1024)
-f fast mode, skips per-char IO tests.
-b no write buffering. fsync() after every write.
If you elected to run this as 'root', it is recommended you use.
-u [uid|username] is the uid to run the test with
-g [gid|group] is the gid to run the test with"

* EXERPT for how to use -n option: "You might see some of the metadata benchmarks reported by Bonnie++ as +++++ instead of a real number per second. This happens when that particular benchmark completes too quickly. To overcome this for benchmarking a particular setup, use the -n option to specify that more files should be used for the metadata tests. With the -n option you can specify up to four parameters. The first is the number of files to create per directory, specified in multiples of 1,024; the second two numbers are the maximum and minimum size of each file used for testing; and the last is how many directories to create, each containing the number of files you nominated with the first parameter. The defaults are to create 16,384 files with a size of 0 bytes in a single directory, which is equivalent to using -n 16:0:0:1 as a parameter to Bonnie++."

* MAN PAGE EXERPT ON USAGE:
"bonnie++ [-d dir] [-s size(MiB)[:chunk-size(b)]] [-n number-to-stat(*1024)[:max-size[:min-size][:num-directories[:chunk-size]]]] [-m machine-name] [-r ram-size-in-MiB] [-x number-of-tests] [-u uid-to-use:gid-to-use] [-g gid-to-use] [-q] [-f size-for-char-io] [-b] [-D] [-p processes | -y p|s ] [-z seed-num|-Z random-file]"

How I Ran the command
=======================

* Since Im root I had to specify another user
* Since I have 613 MB of RAM my tests can be anywhere from 10x to 20x in size: 6130 to 12260 MB
* My /kossboss/test can only fit about 6.7 gb so I will do 6130 MB
* Note you dont have to be exact on the -r or -s, like you can pick your own numbers those are just the recommened

* IF you did make install / or didnt do make install but set your path:
------------------------------------------------------------------------
bonnie++ -r 613 -s 6130 -d /kossboss/test/ -u bitnami

* IF you didnt do make install and didnt set your path:
---------------------------------------------------------
bonnie++ -r 613 -s 6130 -d /kossboss/test/ -u bitnami

My Results on My least expensive (free) amazon ec2 server
=============================================================
# bonnie++ -r 613 -s 6130 -d /kossboss/test/ -u bitnami
Using uid:1000, gid:1000.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...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.97       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -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
amalamp       6130M   270  98 32207   6 21302   4   653  99 10898   1  1719  32
Latency             35193us     228ms    1495ms   26535us     572ms     211ms
Version  1.97       ------Sequential Create------ --------Random Create--------
amalamp             -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 22209  49 +++++ +++ 32378  52 26336  55 +++++ +++ +++++ +++
Latency               177us     528us     558us     191us     107us     344us
1.97,1.97,amalamp,1,1371379300,6130M,,270,98,32207,6,21302,4,653,99,10898,1,1719,
32,16,,,,,22209,49,+++++,+++,32378,52,26336,55,+++++,+++,+++++,+++,35193us,228ms,
1495ms,26535us,572ms,211ms,177us,528us,558us,191us,107us,344us

For more ways to run the command check out the links above
=============================================================
* the end
Comments