Hi, because of teepeedee2 thread, i tried to benchmark ( nginx +
spawn-fcgi
- v8cgi x 1024 children ) vs ( apache2 + mod_php + php5 ) on example of
my
testing and development setting.
############### SIMPLE LOOP AND CONCATENATION
bench.php
<? for($zxc=0;$zxc<999999;++$zxc) { echo ' '.$zxc; } ## time php bench.php > /dev/null real 0m0.833s user 0m0.712s sys 0m0.104s ### bench.esptime for(var zxc=0;zxc<999999;++zxc) { system.stdout(' '+zxc); } ## time v8cgi bench.esp > /dev/null real 0m0.696s user 0m0.668s sys 0m0.004s ############### SIMPLE LOOP, INDEX, MATH AND CONCATENATION ### bench2.php <? $str = array(); $str2 = ' '; $max = 1000; $max2 = 999999; for($zxc=0;$zxc<$max2;++$zxc) { $str[$zxc*$zxc%$max] += $zxc*$zxc%$max; } for($zxc=0;$zxc<$max;++$zxc) { $str2 .= $str[$zxc]; } ## time php bench2.php real 0m0.660s user 0m0.604s sys 0m0.040s ### bench2.esp var $str = []; var $str2 = ' '; var $max = 1000; var $max2 = 999999; for(var $zxc=0;$zxc<$max2;++$zxc) { $str[$zxc*$zxc%$max] += $zxc*$zxc%$max; } for(var $zxc=0;$zxc<$max;++$zxc) { $str2 += $str[$zxc]; } ## time v8cgi bench2.esp real 0m0.319s user 0m0.308s sys 0m0.008s ############### SIMPLE LONG CONCATENATION ### bench3.php <? $str = ''; $max = 999; for($zxc=0;$zxc<$max;++$zxc) { $str .= ''; for($xcv=0;$xcv<$zxc;++$xcv) { $str .= ''; } $str .= ''; } $str .= '' . $zxc . ' ' . $xcv . ' |
' + $zxc + ' ' + $xcv + ' |
Hello <? echo $_GET['name']; ?>
the test.esp script:
response.write(‘
Hello ‘+request.get.name+’
’);############### NGINX0.8 hello someone
ab -n 5000 -c 10 http://127.0.0.1/test.esp?name=john
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software: nginx/0.8.19
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /test.esp?name=john
Document Length: 19 bytes
Concurrency Level: 10
Time taken for tests: 24.448 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 705000 bytes
HTML transferred: 95000 bytes
Requests per second: 204.51 [#/sec] (mean)
Time per request: 48.897 [ms] (mean)
Time per request: 4.890 [ms] (mean, across all concurrent
requests)
Transfer rate: 28.16 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.9 0 48
Processing: 5 49 38.7 35 277
Waiting: 0 48 38.7 34 277
Total: 5 49 38.8 35 277
Percentage of the requests served within a certain time (ms)
50% 35
66% 41
75% 47
80% 56
90% 113
95% 138
98% 166
99% 183
100% 277 (longest request)
############### APACHE2 hello someone
ab -n 5000 -c 1 http://127.0.0.1/test.php?name=john
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /test.php?name=john
Document Length: 329 bytes
Concurrency Level: 1
Time taken for tests: 1.959 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Non-2xx responses: 5000
Total transferred: 2660000 bytes
HTML transferred: 1645000 bytes
Requests per second: 2551.83 [#/sec] (mean)
Time per request: 0.392 [ms] (mean)
Time per request: 0.392 [ms] (mean, across all concurrent
requests)
Transfer rate: 1325.75 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 0.2 0 6
Waiting: 0 0 0.1 0 6
Total: 0 0 0.2 0 7
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 1
100% 7 (longest request)
ab -n 5000 -c 10 http://127.0.0.1/test.php?name=john
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /test.php?name=john
Document Length: 20 bytes
Concurrency Level: 10
Time taken for tests: 1.890 seconds
Complete requests: 5000
Failed requests: 4978
(Connect: 0, Receive: 0, Length: 4978, Exceptions: 0)
Write errors: 0
Non-2xx responses: 4980
Total transferred: 2654880 bytes
HTML transferred: 1638900 bytes
Requests per second: 2645.16 [#/sec] (mean)
Time per request: 3.780 [ms] (mean)
Time per request: 0.378 [ms] (mean, across all concurrent
requests)
Transfer rate: 1371.60 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 0.6 2 9
Processing: 1 2 0.7 2 10
Waiting: 0 2 0.7 1 9
Total: 1 4 0.8 4 11
WARNING: The median and mean for the waiting time are not within a
normal
deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 4
80% 4
90% 4
95% 5
98% 5
99% 6
100% 11 (longest request)
############### APACHE2 bench3.php max 99 with echo
ab -n 50 -c 10 http://127.0.0.1/bench3.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)…done
Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /bench3.php
Document Length: 331 bytes
Concurrency Level: 10
Time taken for tests: 0.040 seconds
Complete requests: 50
Failed requests: 1
(Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Write errors: 0
Non-2xx responses: 50
Total transferred: 127498 bytes
HTML transferred: 116968 bytes
Requests per second: 1258.34 [#/sec] (mean)
Time per request: 7.947 [ms] (mean)
Time per request: 0.795 [ms] (mean, across all concurrent
requests)
Transfer rate: 3133.50 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 2.8 2 12
Processing: 1 5 4.6 2 23
Waiting: 1 3 3.1 2 12
Total: 3 7 5.0 4 25
Percentage of the requests served within a certain time (ms)
50% 4
66% 11
75% 12
80% 13
90% 14
95% 14
98% 25
99% 25
100% 25 (longest request)
ab -n 50 -c 1 http://127.0.0.1/bench3.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)…done
Server Software: Apache/2.2.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /bench3.php
Document Length: 67840 bytes
Concurrency Level: 1
Time taken for tests: 0.201 seconds
Complete requests: 50
Failed requests: 32
(Connect: 0, Receive: 0, Length: 32, Exceptions: 0)
Write errors: 0
Non-2xx responses: 32
Total transferred: 1241628 bytes
HTML transferred: 1231712 bytes
Requests per second: 248.32 [#/sec] (mean)
Time per request: 4.027 [ms] (mean)
Time per request: 4.027 [ms] (mean, across all concurrent
requests)
Transfer rate: 6021.90 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 0 4 4.8 0 11
Waiting: 0 2 2.9 0 10
Total: 0 4 4.9 0 11
Percentage of the requests served within a certain time (ms)
50% 0
66% 10
75% 10
80% 10
90% 11
95% 11
98% 11
99% 11
100% 11 (longest request)
############### NGINX0.8 bench3.esp max 99 with response.write
ab -n 50 -c 1 http://127.0.0.1/bench3.esp
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)…done
Server Software: nginx/0.8.19
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /bench3.esp
Document Length: 67840 bytes
Concurrency Level: 1
Time taken for tests: 2.455 seconds
Complete requests: 50
Failed requests: 0
Write errors: 0
Total transferred: 3398100 bytes
HTML transferred: 3392000 bytes
Requests per second: 20.37 [#/sec] (mean)
Time per request: 49.094 [ms] (mean)
Time per request: 49.094 [ms] (mean, across all concurrent
requests)
Transfer rate: 1351.87 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 27 49 11.1 54 60
Waiting: 26 48 11.0 54 60
Total: 27 49 11.1 55 60
Percentage of the requests served within a certain time (ms)
50% 55
66% 55
75% 56
80% 57
90% 58
95% 60
98% 60
99% 60
100% 60 (longest request)
############### NGINX0.8 other benchmark (print recursively all global
variables)
ab -n 2000 -c 1000 http://127.0.0.1/index.esp
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
Completed 800 requests
Completed 1000 requests
Completed 1200 requests
Completed 1400 requests
Completed 1600 requests
Completed 1800 requests
Completed 2000 requests
Finished 2000 requests
Server Software: nginx/0.8.19
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.esp
Document Length: 47 bytes
Concurrency Level: 1000
Time taken for tests: 3.690 seconds
Complete requests: 2000
Failed requests: 482
(Connect: 0, Receive: 0, Length: 482, Exceptions: 0)
Write errors: 0
Non-2xx responses: 482
Total transferred: 427652 bytes
HTML transferred: 164372 bytes
Requests per second: 542.06 [#/sec] (mean)
Time per request: 1844.801 [ms] (mean)
Time per request: 1.845 [ms] (mean, across all concurrent
requests)
Transfer rate: 113.19 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 83 379.7 48 3008
Processing: 33 514 384.3 343 1295
Waiting: 30 513 384.3 342 1287
Total: 108 597 528.9 344 3378
Percentage of the requests served within a certain time (ms)
50% 344
66% 392
75% 1142
80% 1145
90% 1150
95% 1199
98% 1277
99% 3346
100% 3378 (longest request)
############### AND???
so is it already good enough? because nginx never fail when apache
mostly
did (except less than 10 connections)… and if the fastcgi script was
executed too slow…
btw i’m sorry if this e-mail too large ^^ i’m so excited and happy that
i
found a good justification for leaving apache… ^^
Regards,
GB