ストレージのI/Oパフォーマンス測定ツール「nstress」の使い方
ストレージのI/Oパフォーマンスを測定するツールで「nstress」というツールがあります。
「100% Read」「100% Write」「70% Read 30% Write」などを測定することができます。
nstressツールは下記サイトからダウンロードできます。
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power%20Systems/page/nstress
ここでは、「nstress_AIX6_April_2014.tar」をダウンロードしました。
まず最初に、I/O性能を測定したいストレージ上のVGに、測定用領域としてファイルシステムを作成します。
ここでは、「/test」で作っています。
次に、I/Oテストで使用するファイルをddコマンドで「/test」以下に作成します。
512byte * 2097152 = 1073741824byte (1GByte)
# dd if=/dev/zero of=/test/testfile1 count=2097152 2097152+0 レコードを入力しました。 2097152+0 レコードを出力しました。 #
このテストファイルを4つ作ります。ここでは以下のように作りました。
- /test/testfile1 1GB
- /test/testfile2 1GB
- /test/testfile3 1GB
-
/test/testfile4 1GB
ダウンロードした「nstress_AIX6_April_2014.tar」ファイルを展開すると、その中に「ndisk64」という実行ファイルがあります。
これを使ってI/O性能をテストします。
I/Oテスト実施 (Sequential I/O編)
SequentialでのI/O性能を測定していきます。
テストシナリオは、Read/Write割合いを4つのパターンに分けてテストしてみました。
I/Oテストのシナリオ① Read 100% Write 0%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Sequential | -S |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 100% | -r 100 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -S -r 100 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -S -r 100 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Sequential
Block size = 4096
Read-Write = Read Only
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 11202317 186707.3 | 729.33 746829.04 60.00
2 - 11762711 196046.5 | 765.81 784186.18 60.00
3 - 11864962 197750.5 | 772.46 791001.90 60.00
4 - 11293985 188233.1 | 735.29 752932.50 60.00
TOTALS 46123975 768737.4 | 3002.88 3074949.61
- Seqential procs= 4 read=100% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 46123975回
1秒あたりのI/O回数 → 768737回(IOPS)
1秒あたりのI/Oサイズ → 3002MB
I/Oテストのシナリオ② Read 80% Write 20%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Sequential | -S |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 80% (Write:20%) | -r 80 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -S -r 80 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -S -r 80 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Sequential
Block size = 4096
Read-WriteRatio: 80:20 = read mostly
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 3790907 63181.6 | 246.80 252726.42 60.00
2 - 3075605 51260.1 | 200.23 205040.43 60.00
3 - 3020469 50341.2 | 196.65 201364.92 60.00
4 - 3747108 62452.0 | 243.95 249807.85 60.00
TOTALS 13634089 227234.9 | 887.64 908939.62
- Seqential procs= 4 read= 80% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 13634089回
1秒あたりのI/O回数 → 227234回(IOPS)
1秒あたりののI/Oサイズ → 887MB
I/Oテストのシナリオ③ Read 50% Write 50%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Sequential | -S |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 50% (Write:50%) | -r 50 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -S -r 50 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -S -r 50 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Sequential
Block size = 4096
Read-Write = Equal read and write
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 1101504 18358.3 | 71.71 73433.17 60.00
2 - 593664 9890.8 | 38.64 39563.21 60.02
3 - 3002255 50037.7 | 195.46 200150.84 60.00
4 - 3067713 51128.5 | 199.72 204513.96 60.00
TOTALS 7765136 129415.3 | 505.53 517661.18
- Seqential procs= 4 read= 50% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 7765136回
1秒あたりのI/O回数 → 129415回(IOPS)
1秒あたりのI/Oサイズ → 505MB
I/Oテストのシナリオ④ Read 0% Write 100%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Sequential | -S |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 0% (Write:100%) | -r 100 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -S -r 0 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -S -r 0 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Sequential
Block size = 4096
Read-Write = Write Only
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 2201452 36697.7 | 143.35 146790.72 59.99
2 - 2453249 40895.5 | 159.75 163582.19 59.99
3 - 2463426 41057.6 | 160.38 164230.38 60.00
4 - 2201846 36697.4 | 143.35 146789.41 60.00
TOTALS 9319973 155348.2 | 606.83 621392.69
- Seqential procs= 4 read= 0% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 9319973回
1秒あたりのI/O回数 → 155348回(IOPS)
1秒あたりのI/Oサイズ → 606MB
I/Oテスト実施 (Random I/O編)
SequentialでのI/O性能と同じく、RandomdでのI/Oも測定していきます。
テストシナリオは、Sequentialの時と同じ条件で4つのパターンに分けてテストしてみました。
I/Oテストのシナリオ① Read 100% Write 0%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Random | -R |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 100% | -r 100 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -R -r 100 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -R -r 100 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Random
Block size = 4096
Read-Write = Read Only
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 7574117 126236.6 | 493.11 504946.30 60.00
2 - 7500697 125012.3 | 488.33 500049.25 60.00
3 - 7434081 123901.7 | 483.99 495606.90 60.00
4 - 7429748 123829.4 | 483.71 495317.80 60.00
TOTALS 29938643 498980.1 | 1949.14 1995920.25
- Random procs= 4 read=100% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 29938643回
1秒あたりのI/O回数 → 498980回(IOPS)
1秒あたりのI/Oサイズ → 1949MB
I/Oテストのシナリオ② Read 80% Write 20%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Random | -R |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 80% (Write:20%) | -r 80 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -R -r 80 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -R -r 80 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Random
Block size = 4096
Read-WriteRatio: 80:20 = read mostly
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 6225778 103763.1 | 405.32 415052.57 60.00
2 - 6263936 104399.5 | 407.81 417598.00 60.00
3 - 6349020 105817.1 | 413.35 423268.59 60.00
4 - 6331845 105531.1 | 412.23 422124.31 60.00
TOTALS 25170579 419510.9 | 1638.71 1678043.47
- Random procs= 4 read= 80% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 25170579回
1秒あたりのI/O回数 → 419510回(IOPS)
1秒あたりのI/Oサイズ → 1638MB
I/Oテストのシナリオ③ Read 50% Write 50%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Random | -R |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 50% (Write:50%) | -r 50 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -R -r 50 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -R -r 50 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Random
Block size = 4096
Read-Write = Equal read and write
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 4645693 77428.7 | 302.46 309714.61 60.00
2 - 4623314 77055.6 | 301.00 308222.28 60.00
3 - 4658005 77633.4 | 303.26 310533.69 60.00
4 - 4649225 77487.1 | 302.68 309948.38 60.00
TOTALS 18576237 309604.7 | 1209.39 1238418.97
- Random procs= 4 read= 50% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 18576237回
1秒あたりのI/O回数 → 309604回(IOPS)
1秒あたりのI/Oサイズ → 1209MB
I/Oテストのシナリオ④ Read 0% Write 100%
| 項目 | 設定値 | オプション |
|---|---|---|
| I/O方式 | Random | -R |
| I/Oファイル | /test/testfile1、/test/testfile2、/test/testfile3、/test/testfile4 | -f /test/testfile1:/test/testfile2:/test/testfile3:/test/testfile4 |
| Read (%) | 0% (Write:100%) | -r 100 |
| Blockサイズ | 4096byte (Default) | -b 4K |
| I/Oサイズ | 32MB (Default) | -s 32M |
| I/O時間 | 60秒 | -t 60 |
コマンド実行結果
# ndisk64 -f /test/test1.dat:/test/test2.dat:/test/test3.dat:/test/test4.dat -R -r 0 -M 4 -b 4K -s 32M -t 60
Command: ndisk64 -f /test/test1.dat /test/test2.dat /test/test3.dat /test/test4.dat -R -r 0 -M 4 -b 4K -s 32M -t 60
Synchronous Disk test (regular read/write)
No. of processes = 4
I/O type = Random
Block size = 4096
Read-Write = Write Only
Sync type: none = just close the file
Number of files = 4
File size = 33554432 bytes = 32768 KB = 32 MB
Run time = 60 seconds
Snooze % = 0 percent
----> Running test with block Size=4096 (4KB) ....
Proc - <-----Disk IO----> | <-----Throughput------> RunTime
Num - TOTAL IO/sec | MB/sec KB/sec Seconds
1 - 3578075 59643.8 | 232.98 238575.26 59.99
2 - 3563705 59395.5 | 232.01 237581.83 60.00
3 - 3578287 59657.2 | 233.04 238628.69 59.98
4 - 3573056 59551.1 | 232.62 238204.20 60.00
TOTALS 14293123 238247.5 | 930.65 952989.97
- Random procs= 4 read= 0% bs= 4KB
#
上記の結果から次のことが分かります。
60秒間のI/O回数 → 14293123回
1秒あたりのI/O回数 → 238247回(IOPS)
1秒あたりのI/Oサイズ → 930MB
ndisk64のHELP表示
ndisk64のヘルプは次の内容です。パラメータの指定のやり方によって様々なテストが実施できます。素晴らしいツールですね。
ndisk64 -S Sequential Disk I/O test (file or raw device)
-R Random Disk I/O test (file or raw device)
-t <secs> Timed duration of the test in seconds (default 5)
-f <file> use "File" for disk I/O (can be a file or raw device)
-f <list> list of filenames to use (max 16) [separators :,+]
example: -f f1,f2,f3 or -f /dev/rlv1:/dev/rlv2
-F <file> <file> contains list of filenames, one per line (upto 2047 files)
-M <num> Multiple processes used to generate I/O
-s <size> file Size, use with K, M or G (mandatory for raw device)
examples: -s 1024K or -s 256M or -s 4G
The default is 32MB
-r <read%> Read percent min=0,max=100 (default 80 =80%read+20%write)
example -r 50 (-r 0 = write only, -r 100 = read only)
-b <size> Block size, use with K, M or G (default 4KB)
-O <size> first byte offset use with K, M or G (times by proc#)
-b <list> or use a colon separated list of block sizes (31 max sizes)
example -b 512:1k:2K:8k:1M:2m
-q flush file to disk after each write (fsync())
-Q flush file to disk via open() O_SYNC flag
-i <MB> Use shared memory for I/O MB is the size(max=256 MB)
-v Verbose mode = gives extra stats but slower
-l Logging disk I/O mode = see *.log but slower still
-o "cmd" Other command - pretend to be this other cmd when running
Must be the last option on the line
-K num Shared memory key (default 0xdeadbeef) allows multiple programs
Note: if you kill ndisk, you may have a shared memory
segment left over. Use ipcs and then ipcrm to remove it.
-p Pure = each Sequential thread does read or write not both
-P file Pure with separate file for writers
-C Open files in Concurrent I/O mode O_CIO
-D Open files in Direct I/O mode O_DIRECT
-z percent Snooze percent - time spent sleeping (default 0)
Asynchronous I/O tests (AIO) This now uses POSIX threads and Async I/O API
-A switch on Async I/O use: -S/-R, -f/-F and -r, -M, -s, -b, -C, -D to determine I/O types
(JFS file or raw device)
-x <min> minimum outstanding Async I/Os (default=1, min=1 and min<max)
-X <max> maximum outstanding Async I/Os (default=8, max=1024)
see above -f <file> -s <size> -R <read%> -b <size>
.

