コラム
2021/08/30

ApacheとnginxとLiteSpeedで性能測定してみた!③

  • 開発

はじめに

ApacheとnginxとLiteSpeedで性能測定してみた! 前回は負荷条件を同時接続500人で50000リクエストで、各種Webサーバソフトウェアの性能を測定しました。
今回は負荷条件を変更し、測定してみます。
どのような変化が起こったかご確認ください!

リーフレットダウンロード 

ここで、測定対象のファイルを「小さいサイズの画像(約8K)」から「一般的なWEBコンテンツサイズのHTML(約60K)」に変更してみます。

[root@ip-XXX-XXX-XXX-XXX html]# ll test2.html 
-rw-rw-r-- 1 root root 59238 Feb  2 10:44 test2.html
[root@ip-XXX-XXX-XXX-XXX html]# 

まずはApacheです。

[root@ip-XXX-XXX-XXX-XXX html]# ab -n 50000 -c 500 http://localhost:8080/test2.html
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        Apache/2.4.41
Server Hostname:        localhost
Server Port:            8080

Document Path:          /test2.html
Document Length:        59238 bytes

Concurrency Level:      500
Time taken for tests:   7.691 seconds
Complete requests:      50000
Failed requests:        0
Total transferred:      2976200000 bytes
HTML transferred:       2961900000 bytes
Requests per second:    6501.28 [#/sec] (mean)
Time per request:       76.908 [ms] (mean)
Time per request:       0.154 [ms] (mean, across all concurrent requests)
Transfer rate:          377912.11 [Kbytes/sec] received

Connection Times (ms)
                  min  mean[+/-sd] median   max
Connect:        0   21 117.4      6    1051
Processing:     2   53  60.0     40    1006
Waiting:        0   31  59.1     20     989
Total:         10   73 137.7     47    1902

Percentage of the requests served within a certain time (ms)
      50%     47
      66%     52
      75%     55
      80%     58
      90%     68
      95%    246
      98%    304
      99%   1055
      100%   1902 (longest request)
[root@ip-XXX-XXX-XXX-XXX html]# 

次にnginxです。

[root@ip-XXX-XXX-XXX-XXX html]# ab -n 50000 -c 500 http://localhost:80/test2.html
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        nginx/1.18.0
Server Hostname:        localhost
Server Port:            80

Document Path:          /test2.html
Document Length:        59238 bytes

Concurrency Level:      500
Time taken for tests:   3.267 seconds
Complete requests:      50000
Failed requests:        0
Total transferred:      2973700000 bytes
HTML transferred:       2961900000 bytes
Requests per second:    15303.50 [#/sec] (mean)
Time per request:       32.672 [ms] (mean)
Time per request:       0.065 [ms] (mean, across all concurrent requests)
Transfer rate:          888828.60 [Kbytes/sec] received

Connection Times (ms)
                  min  mean[+/-sd] median   max
Connect:        0    7  49.2      4    1037
Processing:     7   26   4.2     27      62
Waiting:        0    5   2.7      5      48
Total:         11   33  49.5     31    1068

Percentage of the requests served within a certain time (ms)
      50%     31
      66%     32
      75%     32
      80%     32
      90%     33
      95%     33
      98%     47
      99%     54
      100%   1068 (longest request)
[root@ip-XXX-XXX-XXX-XXX html]# 

最後にLiteSpeedです。

[root@ip-XXX-XXX-XXX-XXX html]# ab -n 50000 -c 500 http://localhost:8088/test2.html
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        LiteSpeed
Server Hostname:        localhost
Server Port:            8088

Document Path:          /test2.html
Document Length:        59238 bytes

Concurrency Level:      500
Time taken for tests:   3.509 seconds
Complete requests:      50000
Failed requests:        0
Total transferred:      2974050000 bytes
HTML transferred:       2961900000 bytes
Requests per second:    14250.09 [#/sec] (mean)
Time per request:       35.087 [ms] (mean)
Time per request:       0.070 [ms] (mean, across all concurrent requests)
Transfer rate:          827743.93 [Kbytes/sec] received

Connection Times (ms)
                  min  mean[+/-sd] median   max
Connect:        0   16 123.6      1    1034
Processing:     0   14  15.6     12     424
Waiting:        0   10  15.3      9     420
Total:          0   30 126.1     13    1256

Percentage of the requests served within a certain time (ms)
      50%     13
      66%     15
      75%     17
      80%     18
      90%     21
      95%     24
      98%    102
      99%   1026
      100%   1256 (longest request)
[root@ip-XXX-XXX-XXX-XXX html]# 

今回もパーセンタイルに注目してみます。

パーセンタイル

Apache nginx LiteSpeed
50%     47 50%     31 50%     13
66%     52 66%     32 66%     15
75%     55 75%     32 75%     17
80%     58 80%     32 80%     18
90%     68 90%     33 90%     21
95%    246 95%     33 95%     24
98%    304 98%     47 98%    102
99%   1055 99%     54 99%   1026
100%   1902 100%   1068 100%   1256

Apache・nginx では、今までの測定結果と同じような傾向になりましたが、LiteSpeedの98%で性能の劣化がみられるようになりました。一方、それ以下の性能はnginxよりも速いという結果になっています。
さらに、LiteSpeedでは、ファイルサイズが大きくなったほうが速いという結果が得られました。何度測定してもこの結果は変わらず、単純にファイルサイズと性能は比例しないようです。

今回の測定結果では、nginx・LiteSpeed の方が、Apacheに比べて静的コンテンツをより高速に処理できそうであることを確認できました。
WEBサーバの選定には、運用ノウハウの有無なども関係してきますので、一概に性能だけでWEBサーバを決定することはできませんが、 静的コンテンツの多いサイトであれば、Apache よりも nginx・LiteSpeed の採用を検討してもよいかもしれません。

次回は動的コンテンツの測定を実施したいと思います。

WEBSASくん
  1. <<
  2.   
  3. 1
  4.    
  5. 2
  6.    
  7. 3
  8.  
  9. >>