Sunday, December 23, 2012

Handy tool to find out IOPS in Solaris.


-----------------------------------------------------------------------------------------------------------------------------
Keywords : Solaris, IOPS, Calculate IOPS, Collect IOPS
-----------------------------------------------------------------------------------------------------------------------------
When there are multiple volumes involved in disk IO operation, there is no simple way to calculate Total IOPS in Solaris command line options.

This simple script helps to calculate Total, Avg, Max IOPS & %Read/Write  in run time or offline from iostat output file quickly. You can simply put this perl script in /usr/bin directory with execute permission.

Usage:  [You must use " iostat -xncz" options with this script] 

1. To find IOPS at Run Time : $ iostat -xncz 5 |iopscal

Sample output:
# iostat -xncz 5 |iopscal   or   # iostat -xncz 5 10 |iopscal
        |--------------TOTAL IOPS--------------------| |------KB_Read------| |-----KB_Write------| |------Device Status------|
Count        r/s         w/s        io/s   io/s(K)      kr/s                kw/s                  AvgSrvTm %Wait %DiskBusy
-------------------------------------------------------------------------------------------------------------------------------------------------------
1       3.0 (  3%)   112.9 ( 97%)    116 (  0.12K)      48 (   0.05MB/s)    3686 (   3.6MB/s)      0.6ms    0.0%     5%
2       1.0 ( 50%)     1.0 ( 50%)      2 (  0.00K)      16 (   0.02MB/s)       0 (   0.0MB/s)      0.2ms    0.0%     0%
3       6.0 ( 67%)     3.0 ( 33%)      9 (  0.01K)      96 (   0.09MB/s)      32 (   0.0MB/s)      0.1ms    0.0%     0%
4       2.0 ( 50%)     2.0 ( 50%)      4 (  0.00K)      32 (   0.03MB/s)       8 (   0.0MB/s)      0.2ms    0.0%     0%
5     156.0 ( 99%)     1.0 (  1%)    157 (  0.16K)    2496 (   2.44MB/s)       0 (   0.0MB/s)      0.9ms    0.0%     1%
6       7.0 (  7%)    95.0 ( 93%)    102 (  0.10K)     112 (   0.11MB/s)    5133 (   5.0MB/s)      0.7ms    0.0%    13%
7       2.0 ( 22%)     7.0 ( 78%)      9 (  0.01K)      32 (   0.03MB/s)       4 (   0.0MB/s)      0.2ms    0.0%     0%
8       1.0 ( 50%)     1.0 ( 50%)      2 (  0.00K)      16 (   0.02MB/s)       0 (   0.0MB/s)      0.2ms    0.0%     0%
9      15.0 ( 50%)    15.0 ( 50%)     30 (  0.03K)     238 (   0.23MB/s)     669 (   0.7MB/s)      0.2ms    0.0%     0%
10      1.0 ( 17%)     5.0 ( 83%)      6 (  0.01K)      16 (   0.02MB/s)      20 (   0.0MB/s)      0.2ms    0.0%     0%
11      3.0 (  2%)   136.0 ( 98%)    139 (  0.14K)      48 (   0.05MB/s)    5709 (   5.6MB/s)      0.8ms    0.0%     8%
12      3.0 ( 43%)     4.0 ( 57%)      7 (  0.01K)      48 (   0.05MB/s)      32 (   0.0MB/s)      0.2ms    0.0%     0%
-------Reads/s---------Writes/s---------IOPS-----------KBRead/s--------------KBWrite/s-------------asvc_t--%Wait--%DiskBusy-
Avg    16.7 ( 34%)    31.9 ( 66%)     49 (  0.05K)     267 (   0.26MB/s)    1275 (   1.2MB/s)      0.4ms    0.0%     2%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Max   156.0( 0.16K)  136.0( 0.14K)   157 (  0.16K)    2496 (   2.44MB/s)    5709 (   5.6MB/s)      0.9ms    0.0%    13%
------------------------------------------------------------------------------------------------------------------------------------------------------------------

2. Calculate IOPS from existing iostat output file (post process)


#iopscal <iostat output filename>
Sample :
$ iostat -xncz 5 10  > iostat_file.out
$iopscal   iostat_file.out

     |--------------TOTAL IOPS--------------------| |------KB_Read------| |-----KB_Write------| |------Device Status------|
Count        r/s         w/s        io/s   io/s(K)      kr/s                kw/s                  AvgSrvTm %Wait %DiskBusy
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
1       3.0 (  3%)   112.9 ( 97%)    116 (  0.12K)      48 (   0.05MB/s)    3686 (   3.6MB/s)      0.6ms    0.0%     5%
2       1.0 ( 50%)     1.0 ( 50%)      2 (  0.00K)      16 (   0.02MB/s)       0 (   0.0MB/s)      0.2ms    0.0%     0%
3       6.0 ( 67%)     3.0 ( 33%)      9 (  0.01K)      96 (   0.09MB/s)      32 (   0.0MB/s)      0.1ms    0.0%     0%
4       2.0 ( 50%)     2.0 ( 50%)      4 (  0.00K)      32 (   0.03MB/s)       8 (   0.0MB/s)      0.2ms    0.0%     0%
5     156.0 ( 99%)     1.0 (  1%)    157 (  0.16K)    2496 (   2.44MB/s)       0 (   0.0MB/s)      0.9ms    0.0%     1%
6       7.0 (  7%)    95.0 ( 93%)    102 (  0.10K)     112 (   0.11MB/s)    5133 (   5.0MB/s)      0.7ms    0.0%    13%
7       2.0 ( 22%)     7.0 ( 78%)      9 (  0.01K)      32 (   0.03MB/s)       4 (   0.0MB/s)      0.2ms    0.0%     0%
8       1.0 ( 50%)     1.0 ( 50%)      2 (  0.00K)      16 (   0.02MB/s)       0 (   0.0MB/s)      0.2ms    0.0%     0%
9      15.0 ( 50%)    15.0 ( 50%)     30 (  0.03K)     238 (   0.23MB/s)     669 (   0.7MB/s)      0.2ms    0.0%     0%
-------Reads/s---------Writes/s---------IOPS-----------KBRead/s--------------KBWrite/s-------------asvc_t--%Wait--%DiskBusy-
Avg    16.7 ( 34%)    31.9 ( 66%)     49 (  0.05K)     267 (   0.26MB/s)    1275 (   1.2MB/s)      0.4ms    0.0%     2%
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Max   156.0( 0.16K)  136.0( 0.14K)   157 (  0.16K)    2496 (   2.44MB/s)    5709 (   5.6MB/s)      0.9ms    0.0%    13%
------------------------------------------------------------------------------------------------------------------------------------------------------------------


----------------------------------------------------------------------------------------

iopscal [Dowload Here]

-----------------------------------------------------------------------------------------
Note: You might get this error, if there is no disk activity currently. 
"Input error: Disk count equals zero. Exiting"

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Found this performing a Google search on calculating IOPS. This helped quite a bit. Thank you for making the file available even after 2-years!

    ReplyDelete