サーバーも落ち着いてきたので Apache Bench を回してみる

WordPress
この記事は約9分で読めます。
この記事は最終更新日より 1 年以上経過しています。
画像やリンクが無効になっている可能性もあるのでご了承下さい。

 サーバー機のブートドライブを SSD へと切り替えた事を機に、CentOS 7 にしてみたり Apache 2.4 系になってみたりー、ここ最近ではタイミング良く PHP 7.0 がリリースされたりと、以前にも増して動作が高速化する要素が多くなった。
 WordPress にも Plugin を用いた最適化やらとやって来たので、ここに来て Apache Bench を回してみることにした。


 以前の CentOS 6.6 構成だと WP-SuperCache 無効化時で Request Per Second (以下 PRS) は 4 前後だった。
 現在はどうだろうかなと。

$ ab -n 1000 -c 10 https://bucci.bp7.org/

 同時接続 10 でトータル 1,000 リクエストを投げる。

 先ず現行の CentOS 7.1、Apache 2.4.6、PHP 7.0 + PHP-FPM + MariaDB 10 の構成で WP-SuperCache を OFF にした状態で実行。PHP は OPCache と APCu も動作中。

Server Software:        Apache/2.4.6
Server Hostname:        bucci.bp7.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256

Document Path:          /
Document Length:        62313 bytes

Concurrency Level:      10
Time taken for tests:   78.679 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      62929000 bytes
HTML transferred:       62313000 bytes
Requests per second:    12.71 [#/sec] (mean)
Time per request:       786.793 [ms] (mean)
Time per request:       78.679 [ms] (mean, across all concurrent requests)
Transfer rate:          781.07 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       10   15  11.9     12     171
Processing:   354  770  72.8    771    1088
Waiting:      349  753  71.9    754    1086
Total:        365  785  74.7    786    1131

Percentage of the requests served within a certain time (ms)
  50%    786
  66%    816
  75%    833
  80%    847
  90%    879
  95%    901
  98%    932
  99%    957
 100%   1131 (longest request)

 RPS 12.71 と約 3 倍にもなっている。

 WP-SuperCache を有効化してトップページがスタティックになると更に加速。

Server Software:        Apache/2.4.6
Server Hostname:        bucci.bp7.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256

Document Path:          /
Document Length:        63077 bytes

Concurrency Level:      10
Time taken for tests:   9.574 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      63726000 bytes
HTML transferred:       63077000 bytes
Requests per second:    104.45 [#/sec] (mean)
Time per request:       95.736 [ms] (mean)
Time per request:       9.574 [ms] (mean, across all concurrent requests)
Transfer rate:          6500.45 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       10   36  11.8     37     107
Processing:    14   59  15.8     55     136
Waiting:       12   41  10.7     40      91
Total:         44   95  18.3     92     228

Percentage of the requests served within a certain time (ms)
  50%     92
  66%     96
  75%     99
  80%    102
  90%    119
  95%    135
  98%    151
  99%    162
 100%    228 (longest request)

 RPS 104.45 にもなる。WP-SuperCache を有効化する事で 9 倍速くなる。これだけ裁くことが出来るとなると、うちのブログとしてはオーバースペックにも程があるので、当面は安定した運用が可能だと思われる。

 GTmetrix の評価。一旦 Google AdSense を無効にしてやってみた結果、過去最高記録が出た。
11_gtmetrix

 Nginx で ProxyCache を効かせると、これがどこまで速くなるかな~って気にはなる所だけど。Apache を Back-end に回して Nginx をもってくるのもアリか……

2015/12/19 01:21 追記

 Web Server を Nginx にする計画も進んできたので、実験的かつ一時的に ぶっちろぐ を Nginx で動作させて検証環境の CentOS 7 から Apache Bench を実行してみた。引数は上記と同じく -n 1000 -c 10 にした。

Server Software:        nginx/1.9.9
Server Hostname:        bucci.bp7.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128

Document Path:          /
Document Length:        62839 bytes

Concurrency Level:      100
Time taken for tests:   3.367 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      63191000 bytes
HTML transferred:       62839000 bytes
Requests per second:    297.00 [#/sec] (mean)
Time per request:       336.705 [ms] (mean)
Time per request:       3.367 [ms] (mean, across all concurrent requests)
Transfer rate:          18327.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       15  186  81.4    175     460
Processing:    17  140  60.7    138     311
Waiting:        3   40  24.3     36     227
Total:         32  327  94.0    318     547

Percentage of the requests served within a certain time (ms)
  50%    318
  66%    371
  75%    397
  80%    423
  90%    459
  95%    478
  98%    501
  99%    515
 100%    547 (longest request)

 実際には HTTP/2 にも対応させているが、Apache Bench は HTTP/1.0 を話すので本来の性能では無いが、それにしても Apache よりずっと速い。流石(*゚Д゚)!

 数値自体、純粋に比較出来る物ではないけど HTTP/2 対応の h2load で Bench する次のような結果に。

$ h2load -n 1000 -c 10 https://bucci.bp7.org/
starting benchmark...
spawning thread #0: 10 total client(s). 1000 total requests
TLS Protocol: TLSv1.2
Cipher: ECDHE-RSA-AES128-GCM-SHA256
Application protocol: h2
..
(snip
..

finished in 843.41ms, 1185.67 req/s, 71.46MB/s
requests: 1000 total, 1000 started, 1000 done, 1000 succeeded, 0 failed, 0 errored, 0 timeout
status codes: 1000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 63196490 bytes total, 276000 bytes headers (space savings 4.17%), 62839000 bytes data
                     min         max         mean         sd        +/- sd
time for request:     2.25ms     21.06ms      7.37ms      2.79ms    78.30%
time for connect:    89.19ms     99.34ms     93.80ms      3.50ms    60.00%
time to 1st byte:   104.20ms    113.70ms    109.03ms      3.03ms    60.00%
req/s (client)  :     118.62      122.31      120.16        1.55    60.00%
著者プロフィール
ぶっち

本格的に PC へ触れ始めてたのは 1990 年位から。
興味は PC 全般。OS は Windows と Linux などを嗜む。
プログラマやネットワークエンジニアを経てフリーに活動している 2 児の父な 40 代半ばのおじさんです。

ぶっちをフォローする

コメント

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.