31

How do I test IO performance in Linux?

Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
deeplovepan
  • 769
  • 2
  • 6
  • 9

8 Answers8

38

IO and filesystem benchmark is a complex topic. No single benchmarking tool is good in all situations. Here is a small overview about different benchmarking tools:

Block Storage:

  • IOMeter - Highly customizable and allows to coordinate multiple clients. Needs a Windows PC for the coordination application. Developed by Intel. On Linux, take maximum rates of older (at least 2006.07.27 and earlier) with a pinch of salt because the submission method was not optimal.

File System (synthetic):

  • FFSB - Flexible Filesystem Benchmark. Very neat benchmarking for Linux. Good customization of workload. NFS benchmarking (net-ffsb) a bit unsound.
  • Filebench - Extremely powerful, but originally developed for Solaris. Linux support isn't good.
  • sysbench - Mainly a DB benchmarking tool, but also basic filesystem benchmarking tool.
  • bonnie - Seems to be obsolete.
  • bonnie++ - C++ port of bonnie. Easy, but seems not to be very customizable.

File System (workload):

  • Postmark - Simulates the IO behavior of a mail server. Too small to stress good IO systems.

Stony Brook University and IBM Watson Labs have published a highly recommended journal paper in the "Transaction of Storage" about file system benchmarking, in which they present different benchmarks and their strong and weak points: A nine year study of file system and storage benchmarking. The article clearly points out that the results of most benchmarks at least questionable.


A note: Is the question programming related? Maybe not, but maybe it is. I spend a lot of time benchmarking the IO performance of the systems I develop. At least for me, questions about how to benchmarking these things is highly programming related. Please: Do not close all questions that are not development/programming related from your point of view. The point of view of other developers might be different.

Xaver Kapeller
  • 49,491
  • 11
  • 98
  • 86
dmeister
  • 34,704
  • 19
  • 73
  • 95
  • 1
    +1 - Good list of tools and the Transactions on Storage paper is a good reference. Another potentially useful tool for network-based file system testing (i.e., NFS) is fstress: http://www.cs.duke.edu/ari/fstress/ – Keith Smith Jul 29 '09 at 15:03
20

tool: fio

link: http://freshmeat.net/projects/fio/

test physical disk IO:

    ./fio examples/disk-zone-profile 

set parameter: sequential r/w: rw=read or rw=write random r/w: rw=randread or rw=randwrite

Kendall Hopkins
  • 43,213
  • 17
  • 66
  • 89
deeplovepan
  • 769
  • 2
  • 6
  • 9
  • 1
    These days https://github.com/axboe/fio may be a better link that the [now defunct freshmeat](http://freshmeat.sourceforge.net/about)... – Anon Aug 11 '19 at 14:35
19

if you need a quick way without hassle of installing anything . This is the method I use for write speed test:

dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync

And the output is something like this

root@rackserver:/# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 4.86922 s, 221 MB/s

Also : delete the test file after this to recover the extra space used

Some explanation :

bs = block size
count = the no of blocks to be written

Adjust these parameters to change the size of the file written as per your server specs and the amount of time you want to spend writing.

the read speed as suggested already by gtsouk, can be checked by using /dev/null as output.

arkoak
  • 2,437
  • 21
  • 35
10
dd if=/dev/sda of=/dev/null

Let this run for a few minutes and stop it with ctrl+C. It will print the read transfer speed of your drive/controller. This is the maximum read speed you can get out of your drive.

Jossef Harush Kadouri
  • 32,361
  • 10
  • 130
  • 129
gtsouk
  • 5,208
  • 1
  • 28
  • 35
5

sysbench

See http://www.howtoforge.com/how-to-benchmark-your-system-cpu-file-io-mysql-with-sysbench

Example

sysbench --test=fileio --file-total-size=150G prepare

sysbench --test=fileio --file-total-size=150G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run

It can also test cpu, memory, threads, and database server performance,

It's awesome.

Or testing software written in java: http://www.dacapobench.org/

Zulu
  • 8,765
  • 9
  • 49
  • 56
bastiat
  • 1,799
  • 2
  • 19
  • 38
4

you need to specify what you're testing for, otherwise benchmarks will only mislead. There are different aspects of IO performance that you need to chose to optimize for, and different parameters to play with.

Your system parameters:

  1. storage device: HDD, SSD (which?), Raid (which?)
  2. filesystem, block size, journal mode
  3. file cache, dirty thresholds, amount of memory
  4. IO scheduler, its tunables
  5. number of CPUs
  6. kernel version

Your test parameters:

  1. read or write performance?
  2. sequential or random?
  3. 1 thread or multiple?
  4. size of requests
  5. optimize for throughput or request delay?
n-alexander
  • 14,663
  • 12
  • 42
  • 43
3

There is an excellent program to test block storage IO on Unix called IORATE. You can get a copy at iorate.org.

It can generate complex mixed IO, including re-use (hits) and hot zones for tiered storage testing.

John
  • 31
  • 1
  • 1
    iorate.org seems offline, however downloads are still available at https://sites.google.com/site/vwiorate/home – Stickley Dec 24 '17 at 12:42
2

Take a look at IOzone: http://www.iozone.org/

If you would like to read a whitepaper illustrating real-world usage on an HPC cluster, please see this pdf, page 36: http://i.dell.com/sites/content/business/solutions/hpcc/en/Documents/Dell-NSS-NFS-Storage-solution-final.pdf

bugaboo
  • 121
  • 1
  • 6