Apache bukan pilihan terbaik saat menyajikan konten statis, nginx lebih cocok untuk itu. Saya melakukan benchmark menggunakan http://lekensteyn.nl/index.html sebagai dokumen uji. Ini adalah dokumen yang lebih besar daripada contoh Jiving karena 19 byte tidak realistis untuk halaman yang sebenarnya. Hasilnya cukup menakjubkan, RPi bahkan mengungguli laptop kerja saya (mungkin karena saya memiliki semua jenis switch debugging kernel diaktifkan).
Berikut adalah nginx 1.4.1 yang berjalan di Arch Linux (RPi,, access_log off
ethernet kabel):
$ ab -n 1000 -c 5 http://192.168.2.10/index.html
Server Software: nginx/1.4.1
Server Hostname: 192.168.2.10
Server Port: 80
Document Path: /index.html
Document Length: 2159 bytes
Concurrency Level: 5
Time taken for tests: 2.341 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 2392000 bytes
HTML transferred: 2159000 bytes
Requests per second: 427.18 [#/sec] (mean)
Time per request: 11.705 [ms] (mean)
Time per request: 2.341 [ms] (mean, across all concurrent requests)
Transfer rate: 997.86 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.1 1 1
Processing: 4 11 1.0 11 20
Waiting: 3 11 1.0 10 19
Total: 4 12 1.0 12 21
Percentage of the requests served within a certain time (ms)
50% 12
66% 12
75% 12
80% 12
90% 12
95% 12
98% 17
99% 18
100% 21 (longest request)
Ini laptop saya ( access_log off
, ethernet kabel):
Server Software: nginx/1.4.1
Server Hostname: 192.168.2.12
Server Port: 80
Document Path: /index.html
Document Length: 2159 bytes
Concurrency Level: 5
Time taken for tests: 2.593 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 2392000 bytes
HTML transferred: 2159000 bytes
Requests per second: 385.62 [#/sec] (mean)
Time per request: 12.966 [ms] (mean)
Time per request: 2.593 [ms] (mean, across all concurrent requests)
Transfer rate: 900.79 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 6 3.4 5 82
Processing: 3 7 5.6 6 86
Waiting: 3 7 5.5 5 82
Total: 6 13 6.8 12 94
Percentage of the requests served within a certain time (ms)
50% 12
66% 13
75% 14
80% 15
90% 17
95% 19
98% 24
99% 34
100% 94 (longest request)
Untuk kelengkapan, server jarak jauh saya. Lebih lambat dengan koneksi WAN yang kemungkinan menjadi bottleneck ( access_log
tidak mati juga):
Server Software: nginx/1.2.8
Server Hostname: lekensteyn.nl
Server Port: 80
Document Path: /index.html
Document Length: 2159 bytes
Concurrency Level: 5
Time taken for tests: 11.074 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 2370000 bytes
HTML transferred: 2159000 bytes
Requests per second: 90.30 [#/sec] (mean)
Time per request: 55.371 [ms] (mean)
Time per request: 11.074 [ms] (mean, across all concurrent requests)
Transfer rate: 209.00 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 25 27 2.3 26 59
Processing: 28 29 2.3 28 59
Waiting: 26 27 2.4 27 59
Total: 53 55 3.8 55 102
Percentage of the requests served within a certain time (ms)
50% 55
66% 55
75% 55
80% 55
90% 56
95% 57
98% 59
99% 86
100% 102 (longest request)
Dengan konkurensi yang lebih banyak dan jumlah permintaan yang lebih tinggi, jumlahnya harus lebih dapat diandalkan karena lebih banyak sampel dapat dimasukkan (ketika saya berlari ab
melawan laptop saya dalam mode kabel / nirkabel, angkanya sangat berfluktuasi). Perhatikan bahwa saat menguji dengan log akses aktif, buffer sistem file itu menyebabkan penundaan penulisan yang tidak dapat diprediksi saat direktori log ada di kartu SD.