残念ながらRHEL6.5の場合は、標準のyumレポジトリではインストールできないので、以下に手順を残しておきます。
epelレポジトリを使ってyum経由でインストールする
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm
これでyumでインストールすればOKです。
yum install fio
epelレポジトリを有効にしないでインストールする方法
直接rpmを取得すれば良いので、以下のコマンドでインストールされます。
rpm -Uvh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/fio-2.0.13-1.el6.x86_64.rpm
性能測定の方法
はじめに適当なIOPSのボリュームを作成し、インスタンスにAttachします(ここでは3000iopsのgp2のボリュームを作成しました)。
その後以下のようにファイルシステムを作成し適当な場所にマウントします。
mkfs.ext4 /dev/xvdf
mount /dev/xvdf /mnt
測定を行うには以下のようなコマンドを実行します。複数の例を載せているので好きなものを試してください。なおEBSの場合はランダムアクセスに最適化されています。
# シーケンシャルリード性能測定。ブロックサイズ16K
sudo fio --ioengine=libaio --iodepth=16 --direct=1 --size=100m --numjobs=16 --group_reporting --directory=/mnt --bs=16k --output=/home/ec2-user/result1.txt --name=sequential-read --rw=read
# シーケンシャルライト性能測定。ブロックサイズ16K
sudo fio --ioengine=libaio --iodepth=16 --direct=1 --size=100m --numjobs=16 --group_reporting --directory=/mnt --bs=16k --output=/home/ec2-user/result2.txt --name=sequential-write --rw=write
# ランダムI/O性能測定(リード比率70%)。ブロックサイズ16K
sudo fio --ioengine=libaio --iodepth=16 --direct=1 --size=100m --numjobs=16 --group_reporting --directory=/mnt --bs=16k --output=/home/ec2-user/result3.txt --name=random-r70w30 --rw=randrw --rwmixread=70
# ランダムI/O性能測定(リード比率30%)。ブロックサイズ16K
sudo fio --ioengine=libaio --iodepth=16 --direct=1 --size=100m --numjobs=16 --group_reporting --directory=/mnt --bs=16k --output=/home/ec2-user/result4.txt --name=random-r30w70 --rw=randrw --rwmixread=30
# ランダムI/O性能測定(リード比率0%)。ブロックサイズ16K
sudo fio --ioengine=libaio --iodepth=16 --direct=1 --size=100m --numjobs=16 --group_reporting --directory=/mnt --bs=16k --output=/home/ec2-user/result5.txt --name=random-r0w100 --rw=randrw --rwmixread=0
実行結果は上記の例ではファイルに出力している。ファイルを開くと以下のような感じになっています。ここで、readのiopsが934、writeのiopsが2197で合計すると、3131iopsとなり、プロビジョンした3000iopsとほぼ同等の値が出ていることが分かります。
random-r30w70: (groupid=0, jobs=16): err= 0: pid=1807: Sat Dec 20 00:40:23 2014
read : io=488832KB, bw=14954KB/s, iops=934 , runt= 32689msec
slat (usec): min=2 , max=102759 , avg=2699.31, stdev=12009.31
clat (usec): min=102 , max=493087 , avg=75671.23, stdev=55478.45
lat (usec): min=851 , max=493092 , avg=78370.75, stdev=56711.53
clat percentiles (msec):
| 1.00th=[ 12], 5.00th=[ 15], 10.00th=[ 16], 20.00th=[ 19],
| 30.00th=[ 43], 40.00th=[ 60], 50.00th=[ 71], 60.00th=[ 81],
| 70.00th=[ 93], 80.00th=[ 112], 90.00th=[ 151], 95.00th=[ 178],
| 99.00th=[ 255], 99.50th=[ 306], 99.90th=[ 379], 99.95th=[ 424],
| 99.99th=[ 482]
bw (KB/s) : min= 179, max= 1912, per=6.27%, avg=937.88, stdev=276.78
write: io=1122.4MB, bw=35157KB/s, iops=2197 , runt= 32689msec
slat (usec): min=4 , max=103279 , avg=2593.33, stdev=11752.52
clat (msec): min=1 , max=493 , avg=79.32, stdev=55.37
lat (msec): min=1 , max=507 , avg=81.91, stdev=56.66
clat percentiles (msec):
| 1.00th=[ 12], 5.00th=[ 15], 10.00th=[ 17], 20.00th=[ 20],
| 30.00th=[ 51], 40.00th=[ 65], 50.00th=[ 74], 60.00th=[ 83],
| 70.00th=[ 95], 80.00th=[ 114], 90.00th=[ 155], 95.00th=[ 180],
| 99.00th=[ 255], 99.50th=[ 310], 99.90th=[ 396], 99.95th=[ 429],
| 99.99th=[ 482]
bw (KB/s) : min= 328, max= 4175, per=6.27%, avg=2204.55, stdev=571.14
lat (usec) : 250=0.01%, 500=0.01%, 750=0.01%, 1000=0.01%
lat (msec) : 2=0.01%, 4=0.01%, 10=0.39%, 20=22.83%, 50=7.40%
lat (msec) : 100=42.79%, 250=25.47%, 500=1.10%
cpu : usr=0.13%, sys=0.17%, ctx=30414, majf=0, minf=388
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=99.8%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued : total=r=30552/w=71827/d=0, short=r=0/w=0/d=0
注意事項
初回の性能測定は、EBSがウォーミングされていない可能性があるので、何度か実行してからの結果を採用した方が良いです。