8. @2016 LIG INC.
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/html'});
response.end('<!doctype html><html><body>Hello Node.js!
</body></html>');
}).listen(8080)
Node.jsのコード
9. @2016 LIG INC.
<?php
echo '<!doctype html><html><body>Hello PHP!</body></html>';
※nginxもほぼ初期設定でphpを呼ぶだけのシンプルな物
Nginx+php7のコード
10. @2016 LIG INC.
Node.js
Complete requests: 100
Requests per second: 708.01 [#/sec]
PHP7
Complete requests: 100
Requests per second: 728.06 [#/sec]
おお、PHPすごいぞ
ab -n 100 -c 100
11. @2016 LIG INC.
Node.js
Complete requests: 200
Requests per second: 49.10 [#/sec]
PHP7
Complete requests: 200
Requests per second: 87.96 [#/sec]
おいおい、PHPすごいやん
ab -n 200 -c 200
12. @2016 LIG INC.
Node.js
Complete requests: 400
Requests per second: 80.92 [#/sec]
PHP7
Total of 233 requests completed
あら。。。PHPがさばけない。。。
Node.jsは性能があがる。。。
ab -n 400 -c 400
13. @2016 LIG INC.
Node.js
Complete requests: 600
Requests per second: 90.70 [#/sec]
PHP7
測ってもしょうがないのでこっから計測なし。。。
ab -n 600 -c 600
14. @2016 LIG INC.
Node.js
Complete requests: 800
Requests per second: 99.29 [#/sec]
PHP7
測ってもしょうがないのでこっから計測なし。。。
ab -n 800 -c 800
15. @2016 LIG INC.
Node.js
Complete requests: 1000
Requests per second: 101.25 [#/sec]
PHP7
測ってもしょうがないのでこっから計測なし。。。
ab -n 1000 -c 1000