ferzip.com

Ti serve un programmatore sistemista freelance…contattami!

The best webserver : apache2 vs nginx

La stabilità di un server e quindi la sua affidabilità dipende molto anche da webserver usato, la cosa più sgradevole che si può avere è la sensazione che il server sia troppo lento a rispondere oppure ancora peggio in down, e non solo come servizio web ma con tutti i suoi servizi, magari non per un attacco hacker DDOS o altro, ma semplicemente perchè ci sono troppi utenti.

Questo spiacevole sensazione mi è capita recentemente su un server di produzione, 4 core xeon con 2 Gb di ram, fortunatamente/sfortunatamente si erano collegati oltre 100 utenti in contemporanea, per la precisione erano 107, la macchina in questione serve prinicipalmente un sito con molte parti dinamiche (un CMS ),

Ecco qua sotto le prove di test con apache2 contro nginx

i test sono stati eseguiti sulla stessa pagina statica e sulla stessa macchina geeode 800mhz 512mb ram file sistem su ssd da 2Gb ext3 il tutto in rete locate 100mbit

il test simula 1000 utenti che generano 10 conessioni l’uno

apache2 nginx
Server Software:        Apache/2.2.14
Server Hostname:        192.168.1.194
Server Port:            80

Document Path:          /
Document Length:        45 bytes

Concurrency Level:      1000
Time taken for tests:   15.911 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      3190000 bytes
HTML transferred:       450000 bytes
Requests per second:    628.50 [#/sec] (mean)
Time per request:       1591.092 [ms] (mean)
Time per request:       1.591 [ms] (mean, across all concurrent requests)
Transfer rate:          195.79 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0  201 1027.3      0    9002
Processing:     1  256 675.9    177   13040
Waiting:        1  249 674.9    176   13040
Total:         69  456 1293.7    177   13087

Percentage of the requests served within a certain time (ms)
50%    177
66%    184
75%    188
80%    191
90%    352
95%   3001
98%   3816
99%   9323
100%  13087 (longest request)


Apache2 Server Test

Server Software:        nginx/0.7.64
Server Hostname:        192.168.1.194
Server Port:            80

Document Path:          /
Document Length:        45 bytes

Concurrency Level:      1000
Time taken for tests:   3.906 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    10000
Total transferred:      2603640 bytes
HTML transferred:       450630 bytes
Requests per second:    2560.00 [#/sec] (mean)
Time per request:       390.625 [ms] (mean)
Time per request:       0.391 [ms] (mean, across all concurrent requests)
Transfer rate:          650.91 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    2  11.9      0      80
Processing:     0  125 108.5    120    3678
Waiting:        0  125 108.5    120    3678
Total:          0  127 109.4    125    3724

Percentage of the requests served within a certain time (ms)
50%    125
66%    163
75%    183
80%    194
90%    220
95%    235
98%    249
99%    262
100%   3724 (longest request)


Nginx Test

oltre al numero nettamente superiori di conessioni che riesce a servire nginx occupa decisamente molto meno tempo, da tenere in considerazione anche il minor uso di ram e la chiusura molto più rapida dei processi

inoltre qua si possono trovare delle istruzioni per una installazione più evoluta di nginx  http://www.ferzip.com/?p=490


.

  • Share/Bookmark
Tag: wshp

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes