LoginSignup
38
40

More than 5 years have passed since last update.

LinuxのDISK,CPUベンチマークを確認する

Last updated at Posted at 2015-01-12

Linux環境でのベンチマークについて勉強する機会があったのでメモ。

環境

OS: CentOS 7.0 (on VirtualBox)

DISK

代表的な指標

  • IOPS(Input/Output Per Second): 1秒間のI/O数。
  • bytes/sec: 1秒間当たりのデータ転送量。

fioによるベンチマーク

fio - Flexible IO Testerを利用する。

ダウンロード元:http://git.kernel.dk/?p=fio.git;a=summary

事前準備

fioのテストはデフォルトでは同期I/Oを計測する。
ここでは非同期I/Oでのベンチマークを見るためlibaioを予めインストール。

$ sudo yum -y install libaio-devel
$ wget http://brick.kernel.dk/snaps/fio-2.2.4.tar.gz

解凍&ビルド

$ tar xzvf fio-2.2.4.tar.gz
$ cd fio-2.2.4
$ make
$ sudo make install

設定ファイルの作成

読み込ませるjob fileとして次の通り設定。詳細はman fio

$ vi myjob.fio
[Sequential-Read] # jobの名前
rw=read           # シーケンシャルでreadする
directory=/tmp/   # ベンチマークで使うディレクトリ
size=100m         # ベンチマークで使用するデータサイズ。キャッシュサイズを考慮して決める。
ioengine=libaio   # 非同期I/Oでテストする。指定しないとsync(同期I/O)になる。

[Sequential-Write]
rw=write          # シーケンシャルでwriteする
directory=/tmp/
size=100m
ioengine=libaio

[Random-Read]
rw=randread       # ランダムでreadする
directory=/tmp/
size=100m
ioengine=libaio

[Random-Write]
rw=randwrite      # ランダムでwriteする
directory=/tmp/
size=100m
ioengine=libaio

留意点

  • sizeの値に注意。キャッシュが働くため、測定結果は単純なディスク自体のI/Oではない。
    • 想定されるのがキャッシュに乗るサイズのI/Oならキャッシュより小さく。
    • 想定されるのがキャッシュに乗らないサイズの場合はキャッシュより大きく設定。
  • シーケンシャルを重視するかランダムを重視するか予め決めておく。
    • 比較的大きめのファイル書き込みではシーケンシャルの結果を重視。
    • データベースのように細かい書き込みが多発する場合はランダムの結果を重視。

結果例

上の設定ファイルで実行した結果のうち、Randam-Readを見てみる。
IOPSは2754。もちろん、この結果が良いか悪いかは要件による。

Random-Read: (groupid=0, jobs=1): err= 0: pid=8344: Sun Jan 11 15:17:41 2015
  read : io=102400KB, bw=11019KB/s, iops=2754, runt=  9293msec
    slat (usec): min=68, max=1330.5K, avg=358.89, stdev=8803.86
    clat (usec): min=0, max=33, avg= 0.87, stdev= 0.49
     lat (usec): min=68, max=1330.5K, avg=360.19, stdev=8803.89
    clat percentiles (usec):
     |  1.00th=[    0],  5.00th=[    0], 10.00th=[    0], 20.00th=[    1],
     | 30.00th=[    1], 40.00th=[    1], 50.00th=[    1], 60.00th=[    1],
     | 70.00th=[    1], 80.00th=[    1], 90.00th=[    1], 95.00th=[    1],
     | 99.00th=[    2], 99.50th=[    2], 99.90th=[    4], 99.95th=[    5],
     | 99.99th=[   12]
    bw (KB  /s): min=  325, max=15224, per=54.41%, avg=11989.81, stdev=4502.52
    lat (usec) : 2=98.27%, 4=1.62%, 10=0.10%, 20=0.02%, 50=0.01%
  cpu          : usr=0.13%, sys=35.64%, ctx=25630, majf=0, minf=28
  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=25600/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

演算処理(CPU)

代表的な指標

  • FLOPS(Floating-point Operations Per Second): 1秒間に実行できる浮動小数点計算数。
  • MIPS(Million Istructions Per Second): 1秒間に実行できる命令数。

簡易的な確認方法 /proc/cpuinfo

$ cat /proc/cpuinfo
---
bogomips    : 5250.53
---
項目 意味
bogomips Bogo(簡易的な、という意味) Million Instructions Per Second(秒間処理命令数(単位:100万回))
5250.53 なら 1秒間に52億5053万回命令を実行できる。

UnixBenchによる総合ベンチマーク

UnixBenchは最初のバージョンが1983年に作られた歴史あるベンチマークソフト。
ダウンロード元:http://code.google.com/p/byte-unixbench/

  • マルチコアの場合は1CPUで実行したあとに全CPUで実行し両方の結果が表示される。
  • CPUそのもののベンチマークではなくOSやライブラリ、コンパイラに依存する。
  • ベンチマークの結果として生の数値以外に比較対象となるマシン(*)のデータ、総合評価の値が提供される。
    (*)Sun SPARCstation 20 SM 61 (1995年)

実行されるテストの概要

テスト 説明
Dhrystone 文字列操作のパフォーマンス計測。浮動小数点演算は含まない。
Whetstone 浮動小数点計算のパフォーマンス計測。
Execl Throughput 1秒間に何回execl(プロセスの置き換え)を呼び出せるかを計測。
File Copy 様々なバッファサイズで単位時間(デフォルト10秒)に可能なread,write,copyを計測。
Pipe Throughput 1秒間に何回512bytesのデータをpipeに送り応答をreadできるか計測。
Pipe-based Context Switching 2つのプロセスがpipeを通して整数値をやりとりする際のスループットを計測。
Process Creation 直ちに終了する子プロセスを何回もforkするテスト。
OSのプロセス生成に関する実装の比較に用いられる。
Shell Scripts データ変換処理をするシェルスクリプトを並列起動し(1,2,4,8並列)、1分間に開始/停止を何回繰り返せるか計測。
System Call Overhead システムコールにかかるコストの見積もりテスト。
(内部ではgetpidをコールしている)
Graphical Tests 2D, 3Dグラフィック描画の簡易テスト。

事前準備

$ sudo yum -y install perl perl-Time-HiRes gcc
$ wget http://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz

解凍 & ビルドと実行(Run)

$ tar xzvf UnixBench5.1.3.tgz
$ cd UnixBench && ./Run

結果例

項目 説明
BASELINE SPARCstation20 SM 61 の処理性能を表している固定値。
RESULT ベンチマークを実行したマシンの結果。
INDEX BASELINEとRESULTから導き出されたスコア。
========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: localhost.localdomain: GNU/Linux
   OS: GNU/Linux -- 3.10.0-123.el7.x86_64 -- #1 SMP Mon Jun 30 12:09:22 UTC 2014
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz (5250.5 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
   13:02:00 up 1 day, 15:53,  1 user,  load average: 0.71, 0.23, 0.11; runlevel 3

------------------------------------------------------------------------
Benchmark Run: 日  1月 11 2015 13:02:00 - 13:30:05
1 CPU in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       32221732.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     4232.1 MWIPS (9.8 s, 7 samples)
Execl Throughput                               3295.3 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        916073.0 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          272967.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2171906.8 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1697464.4 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 295175.0 lps   (10.0 s, 7 samples)
Process Creation                              11459.6 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   4231.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    551.2 lpm   (60.1 s, 2 samples)
System Call Overhead                        2793989.1 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   32221732.5   2761.1
Double-Precision Whetstone                       55.0       4232.1    769.5
Execl Throughput                                 43.0       3295.3    766.3
File Copy 1024 bufsize 2000 maxblocks          3960.0     916073.0   2313.3
File Copy 256 bufsize 500 maxblocks            1655.0     272967.4   1649.3
File Copy 4096 bufsize 8000 maxblocks          5800.0    2171906.8   3744.7
Pipe Throughput                               12440.0    1697464.4   1364.5
Pipe-based Context Switching                   4000.0     295175.0    737.9
Process Creation                                126.0      11459.6    909.5
Shell Scripts (1 concurrent)                     42.4       4231.7    998.0
Shell Scripts (8 concurrent)                      6.0        551.2    918.7
System Call Overhead                          15000.0    2793989.1   1862.7
                                                                   ========
System Benchmarks Index Score                                        1349.2

リンク

ベンチマークソフトについては下記記事も参照のこと。

38
40
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
40