fioによるディスクデバイス以外のベンチマーク
ioengine
二本目の記事で書いた通り、fioはHDD以外にもベンチマークを行える
- 色々なベンチマークソフトがある中fioでやる意味はあるのかとも考えるが覚えておいて損はない
オプション
ioengine
で定義された内容でベンチマークの実行ができる
[comicsong@comicsong fio]$ fio --enghelp Available IO engines: cpuio mmap sync psync vsync pvsync pvsync2 null net netsplice libaio posixaio falloc e4defrag splice mtd sg binject
- また個別のioエンジンが持つオプション一覧及びその詳細は
--enghelp=<engine>,<cmd>
確認できる
[comicsong@comicsong fio]$ fio --enghelp=cpuio cpuload : Use this percentage of CPU cpuchunks : Length of the CPU burn cycles (usecs) exit_on_io_done : Exit when IO threads finish [comicsong@comicsong fio]$ fio --enghelp=cpuio,cpuload cpuload: Use this percentage of CPU type: integer value (opt=100) default: no default
- ioengineに限らず、様々なワークロードを想定したサンプルのiniがfioのgitレポジトリには存在する
CPUのベンチマーク
例としてCPUのベンチマークを実行する
jobファイルは前述のサンプルのcpuioの
runtime
を伸ばしたもの
[global] ioengine=cpuio time_based runtime=300 [burn50percent] cpuload=50
- まずはサンプル通り10秒で実施する
[comicsong@comicsong fio]$ fio cpu.ini -runtime 10 fio-2.13-18-gc915 Starting 1 process burn50percent: ioengine=cpuio, cpuload=50, cpucycle=50000 Jobs: 1 (f=1): [R(1)] [100.0% done] [0KB/0KB/0KB /s] [0/0/0 iops] [eta 00m:00s] burn50percent: (groupid=0, jobs=1): err= 0: pid=17197: Mon Aug 1 20:53:54 2016 lat (msec) : 100=100.00% cpu : usr=50.02%, sys=0.00%, ctx=104, majf=0, minf=20 IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 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.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued : total=r=100/w=0/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0 latency : target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs):
ディスクデバイスにIOを発生させるわけではないのでI/O回りは基本カラ
cpu
の項目がusr=50.02%
とCPU負荷のみ発生していることがわかる
負荷発生コアを確認
- screen で前述のfioを実行しつつ
dstat -C 0,1,2,3
を実行、抜粋する
-------cpu0-usage--------------cpu1-usage--------------cpu2-usage--------------cpu3-usage------> usr sys idl wai hiq siq:usr sys idl wai hiq siq:usr sys idl wai hiq siq:usr sys idl wai hiq siq> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 1 99 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 1 0 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 1 0 99 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 1 0 99 0 0 0: 50 0 50 0 0 0> 1 0 99 0 0 0: 0 0 100 0 0 0: 0 1 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 1 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 1 0 99 0 0 0: 0 0 100 0 0 0: 51 0 49 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 1 0 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 1 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 1 0 99 0 0 0: 0 1 99 0 0 0: 0 1 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 1 99 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0>
- 1スレッド中の50% の利用ということがわかる
- また同様にvmstatも確認する
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 516192 2293896 0 1108872 0 0 0 56 672 350 13 0 87 0 0 1 0 516192 2293896 0 1108876 0 0 0 0 656 313 13 0 88 0 0 1 0 516192 2293896 0 1108876 0 0 0 0 653 313 12 0 87 0 0 1 0 516192 2293896 0 1108876 0 0 0 0 653 313 13 0 87 0 0
こちらも同じく4スレッド中の1スレッドの50% = 全体の12.5%の近似値となった
以上の事からオプション項目の
cpuload
はスレッドに対するものだと予測できる- ではプロセス数を増やすとどうなるか
- jobファイルのセッション箇所を以下のように
numjobs=2
を追記編集した
[burn50percent] numjobs=2 cpuload=50
- 同様にdstatで計測
-------cpu0-usage--------------cpu1-usage--------------cpu2-usage--------------cpu3-usage------> usr sys idl wai hiq siq:usr sys idl wai hiq siq:usr sys idl wai hiq siq:usr sys idl wai hiq siq> 1 0 99 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 1 1 98 0 0 0: 1 0 99 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 1 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 51 0 49 0 0 0> 1 1 98 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 1 0 99 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 0 0 100 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0> 1 0 99 0 0 0: 0 0 100 0 0 0: 50 0 50 0 0 0: 50 0 50 0 0 0>
- 1スレッドあたり50%が2スレッドで全体の25%の負荷となった
以上から、パーセンテージ表記の想定通りの負荷にするためにはスレッド数の考慮が必要
おまけ。負荷発生の方法
strace fio cpu.ini
にてどんな方法でcpu負荷を発生させているか確認wait4
システムコールをプロセス数の分だけ起動しているみたい
stat("/tmp/fio-dump-status", 0x7fff46895820) = -1 ENOENT (No such file or directory) nanosleep({0, 10000000}, NULL) = 0 wait4(17442, 0x7fff46896894, WNOHANG, NULL) = 0 wait4(17443, 0x7fff46896894, WNOHANG, NULL) = 0 stat("/tmp/fio-dump-status", 0x7fff46895820) = -1 ENOENT (No such file or directory) nanosleep({0, 10000000}, NULL) = 0 wait4(17442, 0x7fff46896894, WNOHANG, NULL) = 0 wait4(17443, 0x7fff46896894, WNOHANG, NULL) = 0 stat("/tmp/fio-dump-status", 0x7fff46895820) = -1 ENOENT (No such file or directory) nanosleep({0, 10000000}, NULL) = 0 wait4(17442, 0x7fff46896894, WNOHANG, NULL) = 0 wait4(17443, 0x7fff46896894, WNOHANG, NULL) = 0 stat("/tmp/fio-dump-status", 0x7fff46895820) = -1 ENOENT (No such file or directory) nanosleep({0, 10000000}, NULL) = 0 wait4(17442, 0x7fff46896894, WNOHANG, NULL) = 0 wait4(17443, 0x7fff46896894, WNOHANG, NULL) = 0