Nginx vs Apache

PUBLISHED ON 05/12/2017 — BENCHMARKS

A quick and not very scientific nginx and apache comparison.

nginx

$ ab -k -n 10000 -c 100 https://b4d.sablun.org:8443/index.html
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b4d.sablun.org (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        nginx/1.13.3
Server Hostname:        b4d.sablun.org
Server Port:            8443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
TLS Server Name:        b4d.sablun.org

Document Path:          /index.html
Document Length:        4436 bytes

Concurrency Level:      100
Time taken for tests:   1.180 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9900
Total transferred:      46759500 bytes
HTML transferred:       44360000 bytes
Requests per second:    8474.50 [#/sec] (mean)
Time per request:       11.800 [ms] (mean)
Time per request:       0.118 [ms] (mean, across all concurrent requests)
Transfer rate:          38697.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2  16.9      0     260
Processing:     0   10  11.2      9     223
Waiting:        0   10  11.2      9     223
Total:          4   12  19.5      9     260

Percentage of the requests served within a certain time (ms)
  50%      9
  66%      9
  75%      9
  80%      9
  90%     10
  95%     13
  98%     20
  99%    130
 100%    260 (longest request)

$ ab -k -n 100 -c 10 https://b4d.sablun.org:8443/index.html 
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b4d.sablun.org (be patient).....done


Server Software:        nginx/1.13.3
Server Hostname:        b4d.sablun.org
Server Port:            8443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
TLS Server Name:        b4d.sablun.org

Document Path:          /index.html
Document Length:        4436 bytes

Concurrency Level:      10
Time taken for tests:   0.034 seconds
Complete requests:      100
Failed requests:        0
Keep-Alive requests:    100
Total transferred:      467600 bytes
HTML transferred:       443600 bytes
Requests per second:    2931.18 [#/sec] (mean)
Time per request:       3.412 [ms] (mean)
Time per request:       0.341 [ms] (mean, across all concurrent requests)
Transfer rate:          13384.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   5.8      0      24
Processing:     0    2   2.4      1      14
Waiting:        0    2   2.4      1      14
Total:          1    3   6.1      1      25

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      2
  90%     14
  95%     23
  98%     24
  99%     25
 100%     25 (longest request)

apache

$ ab -k -n 10000 -c 100 https://b4d.sablun.org/index.html 
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b4d.sablun.org (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:        Apache
Server Hostname:        b4d.sablun.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128
TLS Server Name:        b4d.sablun.org

Document Path:          /index.html
Document Length:        4436 bytes

Concurrency Level:      100
Time taken for tests:   2.176 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    9910
Total transferred:      47996045 bytes
HTML transferred:       44360000 bytes
Requests per second:    4594.99 [#/sec] (mean)
Time per request:       21.763 [ms] (mean)
Time per request:       0.218 [ms] (mean, across all concurrent requests)
Transfer rate:          21537.22 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   11 122.9      0    2011
Processing:     0    2   1.3      2      36
Waiting:        0    1   1.2      1      36
Total:          0   13 123.1      2    2016

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%      3
  95%      3
  98%      7
  99%     48
 100%   2016 (longest request)

$ ab -k -n 100 -c 10 https://b4d.sablun.org/index.html
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking b4d.sablun.org (be patient).....done


Server Software:        Apache
Server Hostname:        b4d.sablun.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128
TLS Server Name:        b4d.sablun.org

Document Path:          /index.html
Document Length:        4436 bytes

Concurrency Level:      10
Time taken for tests:   0.047 seconds
Complete requests:      100
Failed requests:        0
Keep-Alive requests:    100
Total transferred:      480010 bytes
HTML transferred:       443600 bytes
Requests per second:    2111.93 [#/sec] (mean)
Time per request:       4.735 [ms] (mean)
Time per request:       0.474 [ms] (mean, across all concurrent requests)
Transfer rate:          9899.89 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   5.6      0      28
Processing:     0    3   4.2      2      25
Waiting:        0    2   4.2      1      24
Total:          0    5   8.6      2      31

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%     30
  95%     30
  98%     31
  99%     31
 100%     31 (longest request)