ablog

不器用で落着きのない技術者のメモ

stressコマンドでI/O負荷をかけてみる

http://d.hatena.ne.jp/happs/20100912/1284253155 を参考に stress コマンドで I/O 負荷をかけてみた。


インストールする。

[root@****** ~]# yum install stress

Is this ok [y/N]: y

...

Is this ok [y/N]: y

...

Installed:
  stress.x86_64 0:1.0.4-4.el6

Complete!

I/O負荷をかけてみる。

[root@****** ~]# stress --hdd 1 --timeout 10s
stress: info: [4418] dispatching hogs: 0 cpu, 0 io, 0 vm, 1 hdd
stress: info: [4418] successful run completed in 10s

iostat でI/O負荷を確認する。

[root@****** ~]# iostat -dtx 1
Linux 2.6.32-358.18.1.el6.x86_64 (******.sakura.ne.jp)       09/25/13        _x86_64_        (2 CPU)

09/25/13 21:57:27
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.02    49.78    0.10    0.59     3.38   402.95   590.56     0.05   69.35   1.13   0.08

09/25/13 21:57:28
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

09/25/13 21:57:29
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 101269.00    7.00 1081.00   288.00 818800.00   752.84     9.71    8.92   0.32  34.70

09/25/13 21:57:30
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 125653.00    0.00 1160.00     0.00 965768.00   832.56   112.68   95.20   0.79  91.20

09/25/13 21:57:31
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 54667.00    0.00  471.00     0.00 388648.00   825.15   107.27  140.16   1.98  93.30

09/25/13 21:57:32
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 134311.00    0.00 1390.00     0.00 1135384.00   816.82    97.18   91.99   0.68  94.90

09/25/13 21:57:33
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 76916.00    1.00  680.00     8.00 672184.00   987.07    76.74  131.53   1.18  80.60

09/25/13 21:57:34
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 127777.00    0.00  867.00     0.00 870152.00  1003.64   110.12  101.06   1.07  93.20

09/25/13 21:57:35
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 113925.00    0.00 1061.00     0.00 1055528.00   994.84   120.27  133.35   0.94 100.00

09/25/13 21:57:36
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 164506.00    0.00 1326.00     0.00 1270216.00   957.93    82.54   58.86   0.64  85.10

09/25/13 21:57:37
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 114972.00    2.00  870.00    16.00 875536.00  1004.07    96.05  113.45   1.10  95.50

09/25/13 21:57:38
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 215669.00    0.00 1724.00     0.00 1729496.00  1003.19   115.86   65.14   0.58 100.10

09/25/13 21:57:39
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00 12347.00    0.00  242.00     0.00 241360.00   997.36    71.32  321.41   2.24  54.10

09/25/13 21:57:40
Device:         rrqm/s   wrqm/s     r/s     w/s   rsec/s   wsec/s avgrq-sz avgqu-sz   await  svctm  %util
vda               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

おまけ

どんなシステムコールを発行しているか調べてみる。

[root@****** ~]# strace -f -c stress --hdd 1 --timeout 10s
stress: info: [4430] dispatching hogs: 0 cpu, 0 io, 0 vm, 1 hdd
Process 4431 attached (waiting for parent)
Process 4431 resumed (parent 4430 ready)
Process 4431 detached
stress: info: [4430] successful run completed in 10s
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 73.40    5.966093     5966093         1           wait4
 22.34    1.815787         213      8537           write
  4.26    0.346421       49489         7           close
  0.00    0.000000           0         2           read
  0.00    0.000000           0         8           open
  0.00    0.000000           0         4           fstat
  0.00    0.000000           0        11           mmap
  0.00    0.000000           0         5           mprotect
  0.00    0.000000           0         1           munmap
  0.00    0.000000           0         1           brk
  0.00    0.000000           0         1         1 access
  0.00    0.000000           0         1           nanosleep
  0.00    0.000000           0         1           alarm
  0.00    0.000000           0         1           getpid
  0.00    0.000000           0         1           clone
  0.00    0.000000           0         1           execve
  0.00    0.000000           0         5           unlink
  0.00    0.000000           0         4           gettimeofday
  0.00    0.000000           0         1           arch_prctl
------ ----------- ----------- --------- --------- ----------------
100.00    8.128301                  8593         1 total