- Chapter 3: Popular Unix Performance-Monitoring Tools for Linux
- Interpreting Results and Other Notes
- All-Purpose Tools
- Benchmarking Your Disks with Bonnie
- Other Tools
- Some Network-Monitoring Tools
- ntop
- Summary
Benchmarking Your Disks with Bonnie
Most disk performance-monitoring tools are built into other performance-monitoring tools (take vmstat, for example). However, there is another approach to take. Benchmarking tools can help ascertain a performance bottleneck, even though the one that will be discussed in this section actually can cause somewhat of a bottleneck itself. At the least, it is a good way to test systems before they are put into production.
The particular tool that this section addresses is called bonnie. The bonnie utility runs a performance test of filesystem I/O; it uses standard C library calls. Bonnie writes 8KB blocks in an attempt to discover the maximum sustained rate of transfer. As an added bonus, it cycles through rereading and rewriting to accurately simulate filesystem usage.
To use bonnie, the syntax is pretty simple:
bonnie -d <scratch_directory> -s <size_in_MB_of_testfiles> -m <machine_label>
If no directory is specified, bonnie writes to the current working directory. If no size is given, 10MB is used. The machine label generally does not matter.
The following is some sample output of bonnie on a Sun SparcSTATION5:
$ bonnie File './Bonnie.2831', size: 104857600 Writing with putc()...done Rewriting...done Writing intelligently...done Reading with getc()...done Reading intelligently...done Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done... -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 1650 65.0 1791 12.2 1141 14.1 2379 88.3 3285 20.4 62.5 4.9 $
As you can see, the fields of the final output are very self-explanatory. Now here are the results of bonnie on an x86 platform:
$ bonnie File './Bonnie.22239', size: 104857600 Writing with putc()...done Rewriting...done Writing intelligently...done Reading with getc()...done Reading intelligently...done Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done... -------Sequential Output-------- ---Sequential Input-- --Random-- -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks--- Machine MB K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU K/sec %CPU /sec %CPU 100 2204 12.5 2244 4.3 925 3.1 2356 11.4 2375 6.3 43.0 1.1 $
Just a little different?
Tools like bonnie really help illustrate the difference between an untuned system and a tuned one, or an older (in this case, the sparc system) and a new one (and x86 box).