VMware上のCentOSでApacheのベンチを行ってみるテスト第4弾
本番環境で利用しているアクセス解析(Mogura PlusX)を導入してみる

先にまとめ

予想通りの結果だったけど、やっぱりアクセス解析はサーバーリソースもの凄く消費する。
サーバーにかかる負荷、レスポンス低下は予想より大きかった。
まあ仕方の無いことだし、Moguraはとても優秀な方。これを捨てるなんて勿体ない。

ApacheBenchの回数変更

今回からApacheBenchの回数を変更
ab -n 5000 -c 100 http://xx.xx.xx.xx/test_.html
同時接続数100、アクセス回数5000回に変更。
無駄に沢山アクセスしてもiptabelsに負荷がかかるだけで、それ以外のサーバーの性能を測定出来ていなかった。

まずは初期状態確認

素のHTMLファイル
Concurrency Level:      100
Time taken for tests:   0.927434 seconds
Complete requests:      5000
Failed requests:        0
Write errors:           0
Total transferred:      210903588 bytes
HTML transferred:       209622564 bytes
Requests per second:    5391.22 [#/sec] (mean)
Time per request:       18.549 [ms] (mean)
Time per request:       0.185 [ms] (mean, across all concurrent requests)
Transfer rate:          222075.09 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.3      0      16
Processing:    11   17   2.5     17      38
Waiting:       11   16   2.4     16      36
Total:         11   17   3.6     17      53

Percentage of the requests served within a certain time (ms)
  50%     17
  66%     18
  75%     18
  80%     19
  90%     19
  95%     21
  98%     25
  99%     39
 100%     53 (longest request)
phpが走るHTMLファイル
Concurrency Level:      100
Time taken for tests:   2.475149 seconds
Complete requests:      5000
Failed requests:        0
Write errors:           0
Total transferred:      210765000 bytes
HTML transferred:       209455000 bytes
Requests per second:    2020.08 [#/sec] (mean)
Time per request:       49.503 [ms] (mean)
Time per request:       0.495 [ms] (mean, across all concurrent requests)
Transfer rate:          83156.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.6      1      13
Processing:     4   47   4.7     47      61
Waiting:        4   43   4.4     44      57
Total:          8   48   4.8     48      66

Percentage of the requests served within a certain time (ms)
  50%     48
  66%     50
  75%     51
  80%     52
  90%     54
  95%     55
  98%     57
  99%     58
 100%     66 (longest request)

アクセス解析Mogura PlusXをインクルードしてみる

Concurrency Level:      100
Time taken for tests:   54.713670 seconds
Complete requests:      5000
Failed requests:        4638
   (Connect: 0, Length: 4638, Exceptions: 0)
Write errors:           0
Total transferred:      210592494 bytes
HTML transferred:       209282494 bytes
Requests per second:    91.38 [#/sec] (mean)
Time per request:       1094.273 [ms] (mean)
Time per request:       10.943 [ms] (mean, across all concurrent requests)
Transfer rate:          3758.77 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       5
Processing:    34 1060 1938.4    356   10145
Waiting:        0  111 154.2      4     449
Total:         34 1060 1938.4    357   10145

Percentage of the requests served within a certain time (ms)
  50%    357
  66%    423
  75%    467
  80%    509
  90%   4028
  95%   5359
  98%   9309
  99%  10010
 100%  10145 (longest request)
うおおおおー。
解っていたけど、こういう結果なのねー。
一応、5000アクセス処理するのにかかった時間は54秒。
まあ立派な部類だ。

ベンチ実行直後のPSコマンド

apache    3809  0.2  2.1 255544 11208 ?        S    21:41   0:01 /usr/sbin/httpd
apache    4855  0.1  2.1 255564 11076 ?        S    21:42   0:00 /usr/sbin/httpd
apache    4861  0.1  2.1 255564 11116 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5102  0.1  2.1 255564 11116 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5103  0.1  2.1 255564 11112 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5327  0.1  2.1 255564 11072 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5369  0.0  2.1 255564 11072 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5596  0.1  2.1 255564 11116 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5602  0.1  2.1 255564 11116 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5632  0.1  2.1 255564 11072 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5637  0.1  2.1 255564 11112 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5672  0.1  2.1 255564 11112 ?        S    21:42   0:00 /usr/sbin/httpd
apache    9201  0.6  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9484  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9485  0.3  2.1 255564 11072 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9758  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9762  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9763  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9978  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9979  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9980  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9981  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    9990  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10195  0.2  2.1 255564 11072 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10197  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10198  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10207  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10212  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10214  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10215  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10223  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10224  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10225  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10245  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10253  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10428  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10429  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10432  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10433  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10436  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10437  0.2  2.1 255564 11072 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10438  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10440  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10464  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10467  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10468  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10469  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10470  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10480  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10481  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10490  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10492  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10493  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10494  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10498  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10501  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10502  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10504  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10508  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10509  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10510  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10619  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10620  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10626  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10627  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10628  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10631  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10632  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10634  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10635  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10636  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10656  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10661  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10662  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10663  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10672  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10673  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10679  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10680  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10681  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10682  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10683  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10684  0.3  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10685  0.1  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10686  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10687  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10688  0.2  2.1 255564 11072 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10689  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10690  0.4  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache   10691  0.2  2.1 255564 11064 ?        S    21:48   0:00 /usr/sbin/httpd
apache    4862  0.1  2.2 255764 11492 ?        S    21:42   0:00 /usr/sbin/httpd
apache    5143  0.1  2.2 255604 11340 ?        S    21:42   0:00 /usr/sbin/httpd
root      3337  0.0  2.4 252448 12380 ?        Ss   20:58   0:00 /usr/sbin/httpd
apache    5356  0.1  2.6 258280 13628 ?        S    21:42   0:00 /usr/sbin/httpd
すげー量の子プロセスが生まれていた。ロードアベレージは0.9~2.4あたりを行ったり来たり。
空きメモリは3MBまで現象。
ベンチ終了後は10~15秒で120MBまで復帰。10分置いたら240MBまで復帰。
httpdの子プロセスの寿命や消費するメモリ量って、なんか謎。
KeepAlive ON/OFFでも随分挙動が違う。鯖管理の経験積んで、「なんとなく理解」するしかないかもしんない。

今回はここまで

とりあえず、色々見えてくるものがあった。それなりにサーバー管理やっている人には当たり前の知識なんだろうが、私にとっては大いに収穫があった。