Friday, July 25, 2014

Tools for benchmarking Hard Disk performance(File system Read Write Performance)

dd

dd command can be used to read and write from any block device in Linux.
Using dd command we can perform simple sequential read and sequential write tests

Using dd command to check sequential write speed by writing a 1GB file to disk

dd if=/dev/zero of=/tmp/outputfile bs=1M count=1000

But the above test has a drawback.Any data written to disk is first cached in memory and then written to the disk. So in the above test, it gives the speed at which data was cached into RAM and not the speed at which data was written to the disk. So the above command is tweaked as follows

dd if=/dev/zero of=/tmp/outputfile bs=1M count=1000 conv=fdatasync

So now the dd command will report the write speed only after the data is synced to the disk

Alternative way,

  sync;time bash -c "(dd if=/dev/zero of=/tmp/outputfile bs=1M count=1000; sync)"

Using dd command to check sequential read speed

   dd if=/tmp/outputfile of=/dev/null bs=1M count=1000

hdparm 

It is a performance and benchmarking tool for SATA/IDE drives.

To measure how many MB/s, the hard drive can read
     hdparm -t --direct /dev/sda1
     (or) hdparm -tT /dev/sda1

  -t  : read from cache buffer
  -T : speed of reading without precached buffer

iozone

iozone is an open source file system benchmarking utility.

The default command line option is -a, which stands for full automatic mode. It tests with block sizes ranging from 4k to 16M and file sizes ranging from 64k to 512M.

     iozone -a /dev/sda1

iozone performs 13 types of tests. Some important tests are

Write : Indicates the speed of writing a new file to the filesystem. Creating a new file is always slower than rewriting an existing file owing to the metadata overhead involved while creating a new file (like creating a new inode entry).

ReWrite : Indicates the speed of writing to an existing file

Read : Indicates the speed of reading an existing file

ReRead : Indicates the speed of rereading a file that is already read.

RandomRead : Indicates the speed at which random areas of a single file are read.

RandomWrite : Indicates the speed at which we can write into random areas of a file





No comments:

Post a Comment