Skip to content

Instantly share code, notes, and snippets.

@creationix
Created August 29, 2012 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creationix/3517969 to your computer and use it in GitHub Desktop.
Save creationix/3517969 to your computer and use it in GitHub Desktop.
luvit http vs luvit web vs node http
local server = require("http").createServer(require('stack').stack(
function (req, res)
res:writeHead(200, {
["Content-Type"] = "text/plain",
["Content-Length"] = 12
})
res:finish("Hello World\n")
end
)):listen(process.env.PORT or 8080, "127.0.0.1")
local address = server:address()
p("http server listening on http://" .. address.address .. ':' .. address.port .. '/')
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)
Server Software: Luvit
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 2.009 seconds
Complete requests: 5002
Failed requests: 0
Write errors: 0
Keep-Alive requests: 5002
Total transferred: 779124 bytes
HTML transferred: 60024 bytes
Requests per second: 2489.87 [#/sec] (mean)
Time per request: 40.163 [ms] (mean)
Time per request: 0.402 [ms] (mean, across all concurrent requests)
Transfer rate: 378.74 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 1 39 5.1 40 44
Waiting: 0 1 1.0 1 8
Total: 2 39 5.0 40 44
Percentage of the requests served within a certain time (ms)
50% 40
66% 40
75% 40
80% 40
90% 40
95% 40
98% 42
99% 44
100% 44 (longest request)
local server = require('web').createServer("127.0.0.1", process.env.PORT or 8080, require('cleanup')(function (req, res)
return res(200, {
["Content-Type"] = "text/plain",
["Content-Length"] = 12
}, "Hello World\n")
end))
local address = server:getsockname()
p("http server listening on http://" .. address.address .. ':' .. address.port .. '/')
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)
Server Software: Luvit
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 1.042 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 50000
Total transferred: 8600000 bytes
HTML transferred: 600000 bytes
Requests per second: 47989.90 [#/sec] (mean)
Time per request: 2.084 [ms] (mean)
Time per request: 0.021 [ms] (mean, across all concurrent requests)
Transfer rate: 8060.80 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 2
Processing: 0 2 0.2 2 4
Waiting: 0 2 0.2 2 4
Total: 1 2 0.2 2 5
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 2
98% 2
99% 2
100% 5 (longest request)
var server = require('http').createServer(require('stack')(
function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain',
'Content-Length': 12
});
res.end("Hello World\n")
}
)).listen(process.env.PORT || 8080, "127.0.0.1", function () {
var address = server.address();
console.log("http server listening on http://%s:%s/", address.address, address.port)
});
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)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 2.000 seconds
Complete requests: 45328
Failed requests: 0
Write errors: 0
Keep-Alive requests: 45328
Total transferred: 6255264 bytes
HTML transferred: 543936 bytes
Requests per second: 22663.94 [#/sec] (mean)
Time per request: 4.412 [ms] (mean)
Time per request: 0.044 [ms] (mean, across all concurrent requests)
Transfer rate: 3054.32 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 2
Processing: 2 4 0.3 4 8
Waiting: 2 4 0.3 4 8
Total: 2 4 0.3 4 9
Percentage of the requests served within a certain time (ms)
50% 4
66% 4
75% 4
80% 4
90% 5
95% 5
98% 6
99% 6
100% 9 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment