iostat and IOPS

Posted on Monday, January 6, 2014


iostat is command for monitoring devices (Hard Drives) attached to the system.  This is another tool I feel a little foolish for just discovering.

iostat is a good tool to discover actual IOPS (Operations per second) http://en.wikipedia.org/wiki/IOPS [1]
I recently was tasked with making an RDS amazon server with a set IOPS on its hard drive.  AWS offers guaranteed IOPS speed for a higher price.  It’s a very useful feature to guarantee speed on your Database.

I wanted to test our current "Live" database to see what IOPS it is currently using.  I found a few calculator sites out there to figure out our theoretical IOPS on the database server such as http://wintelguy.com/raidperf.pl [2].  We got an estimate of ~400 IOPS.  This number made me feel good, since the smallest IOPS you can buy on AWS is 1,000 and increment by 1,000.

This estimated rate is not the actual live rate, just an estimate of capacity.  I wanted to see what the actual rate we were using is.

iostat command

The iostat command is no longer installed by default on Ubuntu (my linux flavor of choice).

To install it run

> sudo apt-get install sysstat



Run the iostat command and read it


> iostat






These stats show the statistics since start up.   


The tps = IOPS.    Since this machine was rebooted (many many months ago it has averaged 247 IOPS real usage)


What if I want to see more recent statistics?

Here is a command I ran


> iostat -dm 10 3


What this says is "-d" only display utilization report
"-m" says convert read/write to MiB

The next number, in this case 10, is the interval to look at.   10 is 10 seconds.

The final number, in this case 3, is the count number.   Check 3 times.

So If I run this command I will see something like this



The first number displayed is the average since the server was last started.   The following number is the average over 10 seconds.

If I leave off the last number and run


> iostat -dm 10


iostat will just continue to get the results every 10 seconds.


This is exactly what I was looking for and I am not going to go into any more detail on iostat.  If you need more detail I would suggest first reading all of http://www.percona.com/live/mysql-conference-2013/sites/default/files/slides/Monitoring-Linux-IO.pdf [3]





References
[1]        Wikipedia IOPS page
                Accessed 01/2014
[2]        Raid Performance Calculator
                Accessed 01/2014
[3]        Monitoring IO Performance using iostat & pt-diskstats
Accessed 01/2014


2 comments:

  1. FYI - You have a typo in " sudo apt-get install systat"
    its "sysstat", not "systat".

    Otherwise its a great article :)

    ReplyDelete
  2. Thanks so much for the catch. Updated the article with sysstat now
    Hate it when I mistype the first command in an article :)

    ReplyDelete