Apache is not the best choice when serving static content, nginx is better suited for that. I did a benchmark using http://lekensteyn.nl/index.html as test document. It is a larger document than Jiving's example since 19 bytes is not realistic for an actual page. The results are quite amazing, the RPi even outperforms my work laptop (maybe because I have all kinds of kernel debugging switches enabled).
Here is nginx 1.4.1 running on Arch Linux (RPi, access_log off
, wired ethernet):
$ 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)
This is my laptop (access_log off
, wired ethernet):
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)
For completeness, my remote server. It is slower with the WAN connection being the likely bottleneck (access_log
is not off either):
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)
With more concurrency and higher requests count, the numbers should be more reliable as more samples can be included (when I ran ab
against my laptop in wires/wireless mode, its numbers fluctuated highly). Note that when testing with access logs on, that file system buffers cause unpredictable write delays when the log directory is on the SD card.