Skip to content

Instantly share code, notes, and snippets.

@soapdog
Created September 21, 2016 20:23
Show Gist options
  • Save soapdog/22053e45a713b44b6f9c133e299507e8 to your computer and use it in GitHub Desktop.
Save soapdog/22053e45a713b44b6f9c133e299507e8 to your computer and use it in GitHub Desktop.
Naive benchmark for Luvit vs Nodejs
This is a naive benchmark, it may not reflect real world usage. I basically used the same server script for Lua (luvit) and NodeJS
and fired the siege tool against it for 60 seconds and then 120 seconds. Luvit came ahead on both cases.
=== NodeJS 60s ===
Transactions: 18136 hits
Availability: 94.64 %
Elapsed time: 49.61 secs
Data transferred: 0.21 MB
Response time: 0.04 secs
Transaction rate: 365.57 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 14.26
Successful transactions: 18136
Failed transactions: 1028
Longest transaction: 0.61
Shortest transaction: 0.00
=== NodeJS 120s ===
Transactions: 22139 hits
Availability: 95.56 %
Elapsed time: 38.89 secs
Data transferred: 0.25 MB
Response time: 0.02 secs
Transaction rate: 569.27 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 13.95
Successful transactions: 22139
Failed transactions: 1028
Longest transaction: 0.37
Shortest transaction: 0.00
=== Luvit 60s ===
Transactions: 30941 hits
Availability: 96.79 %
Elapsed time: 44.19 secs
Data transferred: 0.35 MB
Response time: 0.02 secs
Transaction rate: 700.18 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 14.14
Successful transactions: 30941
Failed transactions: 1025
Longest transaction: 0.19
Shortest transaction: 0.00
=== Luvit 120s ===
Transactions: 30056 hits
Availability: 96.71 %
Elapsed time: 41.37 secs
Data transferred: 0.34 MB
Response time: 0.02 secs
Transaction rate: 726.52 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 14.23
Successful transactions: 30056
Failed transactions: 1024
Longest transaction: 0.19
Shortest transaction: 0.00
const http = require('http');
const hostname = '127.0.0.1';
const port = 5001;
http.createServer((req, res) => {
var body = 'Hello Worldn';
res.writeHead(200, { 'Content-Type': 'text/plain', 'Content-Length': body.length });
res.end(body);
}).listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
local http = require('http')
http.createServer(function (req, res)
local body = "Hello Worldn"
res:setHeader("Content-Type", "text/plain")
res:setHeader("Content-Length", #body)
res:finish(body)
end):listen(5000, '127.0.0.1')
print('Server running at http://127.0.0.1:5000/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment