What is fastest? HTML, Lua, Node.js, or PHP

I installed in a server OpenResty and PHP-FPM.

OpenResty is very interesting because Lua is integrated with Nginx.

This is Nginx configuration for Lua:

location /lua {
        default_type text/html;
        content_by_lua 'ngx.say("<p>Hello</p>")';

And for PHP-FPM:

location ~ \.php$ {
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;

This is a little program with Express:

var express = require('express');
var app = express();
app.get('/', function (req, res) {
var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;
  console.log('Example app listening at http://%s:%s', host, port);

I used Apache HTTP server benchmarking tool for tests:

ab -k -n 50000 -c 2 -e lua.csv
ab -k -n 50000 -c 2 -e html.csv
ab -k -n 50000 -c 2 -e node.csv
ab -k -n 50000 -c 2 -e php.csv

All pages show same content:


And these are the results:



And the winner is Lua!!!

Published on in Systems