lunes, 28 de noviembre de 2011

Nginx 1.0.10 vs apache 2.2.14 benchmark

Realizando un benchmark en local sobre una aplicación basada en PHP5.3 y MySQL 5.1 sobre Ubuntu Server 11 virtualizado con 512MB de RAM.
Dicha aplicación realiza una conexión a memcached, una a mysql, carga sesiones y muestra imagenes y un listado de información con enlaces.
La versión Nginx utiliza php5.3 como spawn-fascgi y la de Apache php5.3 como módulo.

Resumen: La velocidad de conexión de Nginx es muy superior a la de Apache. También el número de request fallidas es menor en Nginx. El número de requests por segundo es muy similar, un poco superior Nginx (faltaría realizar el benchmark en un servidor dedicado con más carga para ver resultados en escala)
El transfer rate tambien es superior en Nginx.
A priori parece que Nginx 10.0.10 es superior a Apache 2.2.14.

NGINX 1.0.10

ab -c10 -n10
Document Path:          /
Document Length:        422711 bytes

Concurrency Level:      10
Time taken for tests:   0.790 seconds
Complete requests:      10
Failed requests:        5
   (Connect: 0, Receive: 0, Length: 5, Exceptions: 0)
Write errors:           0
Total transferred:      4231215 bytes
HTML transferred:       4226815 bytes
Requests per second:    12.66 [#/sec] (mean)
Time per request:       790.090 [ms] (mean)
Time per request:       79.009 [ms] (mean, across all concurrent requests)
Transfer rate:          5229.84 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    6   1.8      6       7
Processing:    95  436 232.3    476     783
Waiting:       88  433 233.1    474     781
Total:         96  442 233.4    482     789

Percentage of the requests served within a certain time (ms)
  50%    482
  66%    558
  75%    632
  80%    711
  90%    789
  95%    789
  98%    789
  99%    789
 100%    789 (longest request)

ab -c100 -n100

Document Path:          /
Document Length:        422652 bytes

Concurrency Level:      100
Time taken for tests:   7.723 seconds
Complete requests:      100
Failed requests:        19
   (Connect: 0, Receive: 0, Length: 19, Exceptions: 0)
Write errors:           0
Total transferred:      42310321 bytes
HTML transferred:       42266321 bytes
Requests per second:    12.95 [#/sec] (mean)
Time per request:       7722.813 [ms] (mean)
Time per request:       77.228 [ms] (mean, across all concurrent requests)
Transfer rate:          5350.21 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8   12   1.2     12      14
Processing:   100 3910 2221.9   3948    7705
Waiting:       93 3907 2221.9   3946    7703
Total:        108 3921 2220.9   3960    7715

Percentage of the requests served within a certain time (ms)
  50%   3960
  66%   5183
  75%   5872
  80%   6254
  90%   7030
  95%   7406
  98%   7635
  99%   7715
 100%   7715 (longest request)

ab -c100 -n100

Document Path:          /
Document Length:        422652 bytes

Concurrency Level:      100
Time taken for tests:   7.830 seconds
Complete requests:      100
Failed requests:        18
   (Connect: 0, Receive: 0, Length: 18, Exceptions: 0)
Write errors:           0
Total transferred:      42310262 bytes
HTML transferred:       42266262 bytes
Requests per second:    12.77 [#/sec] (mean)
Time per request:       7829.963 [ms] (mean)
Time per request:       78.300 [ms] (mean, across all concurrent requests)
Transfer rate:          5276.99 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3   10   0.8     10      11
Processing:    92 3978 2253.4   4014    7817
Waiting:       83 3975 2253.7   4012    7815
Total:         95 3988 2253.3   4025    7827

Percentage of the requests served within a certain time (ms)
  50%   4025
  66%   5270
  75%   5968
  80%   6352
  90%   7130
  95%   7516
  98%   7748
  99%   7827
 100%   7827 (longest request)

ab -c100 -n100

Document Path:          /
Document Length:        422652 bytes

Concurrency Level:      100
Time taken for tests:   7.817 seconds
Complete requests:      100
Failed requests:        24
   (Connect: 0, Receive: 0, Length: 24, Exceptions: 0)
Write errors:           0
Total transferred:      42310616 bytes
HTML transferred:       42266616 bytes
Requests per second:    12.79 [#/sec] (mean)
Time per request:       7816.506 [ms] (mean)
Time per request:       78.165 [ms] (mean, across all concurrent requests)
Transfer rate:          5286.12 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8   11   1.4     11      13
Processing:   103 3942 2264.7   3966    7800
Waiting:       97 3940 2264.8   3964    7798
Total:        111 3953 2263.5   3977    7809

Percentage of the requests served within a certain time (ms)
  50%   3977
  66%   5245
  75%   5953
  80%   6341
  90%   7110
  95%   7502
  98%   7730
  99%   7809
 100%   7809 (longest request)

 ab -c100 -n100

Document Path:          /
Document Length:        422652 bytes

Concurrency Level:      100
Time taken for tests:   7.723 seconds
Complete requests:      100
Failed requests:        17
   (Connect: 0, Receive: 0, Length: 17, Exceptions: 0)
Write errors:           0
Total transferred:      42310203 bytes
HTML transferred:       42266203 bytes
Requests per second:    12.95 [#/sec] (mean)
Time per request:       7722.831 [ms] (mean)
Time per request:       77.228 [ms] (mean, across all concurrent requests)
Transfer rate:          5350.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8   11   1.6     11      14
Processing:    97 3895 2228.0   3935    7707
Waiting:       91 3893 2228.1   3934    7705
Total:        104 3906 2226.7   3946    7715

Percentage of the requests served within a certain time (ms)
  50%   3946
  66%   5158
  75%   5852
  80%   6247
  90%   7028
  95%   7406
  98%   7636
  99%   7715
 100%   7715 (longest request)


APACHE 2.2.14

ab -c10 -n10

Document Path:          /
Document Length:        422563 bytes

Concurrency Level:      10
Time taken for tests:   0.925 seconds
Complete requests:      10
Failed requests:        2
   (Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
Write errors:           0
Total transferred:      4230478 bytes
HTML transferred:       4225748 bytes
Requests per second:    10.81 [#/sec] (mean)
Time per request:       924.868 [ms] (mean)
Time per request:       92.487 [ms] (mean, across all concurrent requests)
Transfer rate:          4466.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   19  11.1     24      33
Processing:   852  893  20.4    893     921
Waiting:      813  882  26.9    888     905
Total:        870  912  16.5    919     924

Percentage of the requests served within a certain time (ms)
  50%    919
  66%    922
  75%    923
  80%    924
  90%    924
  95%    924
  98%    924
  99%    924
 100%    924 (longest request)

 ab -c100 -n100

Document Path:          /
Document Length:        422563 bytes

Concurrency Level:      100
Time taken for tests:   8.558 seconds
Complete requests:      100
Failed requests:        22
   (Connect: 0, Receive: 0, Length: 22, Exceptions: 0)
Write errors:           0
Total transferred:      42304838 bytes
HTML transferred:       42257538 bytes
Requests per second:    11.68 [#/sec] (mean)
Time per request:       8558.492 [ms] (mean)
Time per request:       85.585 [ms] (mean, across all concurrent requests)
Transfer rate:          4827.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4   49  13.6     48      75
Processing:   793 5430 2813.8   6758    8504
Waiting:      747 5376 2805.2   6678    8487
Total:        840 5480 2821.6   6805    8554

Percentage of the requests served within a certain time (ms)
  50%   6805
  66%   7916
  75%   8072
  80%   8088
  90%   8540
  95%   8550
  98%   8554
  99%   8554
 100%   8554 (longest request)

  ab -c100 -n100

Document Path:          /
Document Length:        422563 bytes

Concurrency Level:      100
Time taken for tests:   8.607 seconds
Complete requests:      100
Failed requests:        31
   (Connect: 0, Receive: 0, Length: 31, Exceptions: 0)
Write errors:           0
Total transferred:      42305429 bytes
HTML transferred:       42258129 bytes
Requests per second:    11.62 [#/sec] (mean)
Time per request:       8607.071 [ms] (mean)
Time per request:       86.071 [ms] (mean, across all concurrent requests)
Transfer rate:          4799.99 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4  163 127.8     84     325
Processing:  6461 7214 616.1   7012    8278
Waiting:     6103 6944 760.3   6573    8273
Total:       6547 7377 716.6   7093    8603

Percentage of the requests served within a certain time (ms)
  50%   7093
  66%   7126
  75%   8104
  80%   8388
  90%   8587
  95%   8599
  98%   8602
  99%   8603
 100%   8603 (longest request)

  ab -c100 -n100

Document Path:          /
Document Length:        422563 bytes

Concurrency Level:      100
Time taken for tests:   9.823 seconds
Complete requests:      100
Failed requests:        29
   (Connect: 0, Receive: 0, Length: 29, Exceptions: 0)
Write errors:           0
Total transferred:      42305128 bytes
HTML transferred:       42257828 bytes
Requests per second:    10.18 [#/sec] (mean)
Time per request:       9822.757 [ms] (mean)
Time per request:       98.228 [ms] (mean, across all concurrent requests)
Transfer rate:          4205.91 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4  155 126.5    151     495
Processing:  7946 9139 547.0   9434    9787
Waiting:     7205 8530 625.4   8407    9625
Total:       7995 9294 501.7   9620    9822

Percentage of the requests served within a certain time (ms)
  50%   9620
  66%   9714
  75%   9719
  80%   9792
  90%   9797
  95%   9800
  98%   9821
  99%   9822
 100%   9822 (longest request)

  ab -c100 -n100

Document Path:          /
Document Length:        422563 bytes

Concurrency Level:      100
Time taken for tests:   8.035 seconds
Complete requests:      100
Failed requests:        31
   (Connect: 0, Receive: 0, Length: 31, Exceptions: 0)
Write errors:           0
Total transferred:      42305366 bytes
HTML transferred:       42258066 bytes
Requests per second:    12.45 [#/sec] (mean)
Time per request:       8035.316 [ms] (mean)
Time per request:       80.353 [ms] (mean, across all concurrent requests)
Transfer rate:          5141.53 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4  142 130.2     78     462
Processing:  7486 7786 129.2   7773    7991
Waiting:     7130 7556 193.8   7594    7980
Total:       7726 7928  63.0   7948    8032

Percentage of the requests served within a certain time (ms)
  50%   7948
  66%   7949
  75%   7950
  80%   7950
  90%   7951
  95%   7952
  98%   8027
  99%   8032
 100%   8032 (longest request)
 

No hay comentarios: