Created
March 7, 2012 19:08
-
-
Save JakSprats/1995192 to your computer and use it in GitHub Desktop.
AlchemyREST vs Luvit+AlchemyDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz | |
# Ubuntu 9.10 64 bit | |
git clone https://github.com/luvit/luvit.git | |
(cd luvit | |
make | |
make install | |
) | |
git clone git://github.com/JakSprats/Alchemy-Database.git | |
(cd Alchemy-Database | |
make | |
(cd redis/src/luvit | |
make | |
cp alchemy.luvit /usr/local/lib/luvit | |
) | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
(cd Alchemy-Database/redis/src/ | |
taskset -c 0 ./alchemy-server ../redis.conf & </dev/null | |
) | |
(cd luvit | |
taskset -c 0 luvit alchemy_server.lua & </dev/null | |
) | |
taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:6379/SET/X/1" > Alchemy_SET_Results.txt 2>&1 | |
taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:6379/GET/X" > Alchemy_GET_Results.txt 2>&1 | |
taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:8080/SET/X/1" > Luvit_SET_Results.txt 2>&1 | |
taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:8080/GET/X" > Luvit_GET_Results.txt 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local table = require('table'); | |
local string = require('string'); | |
local http = require("http"); | |
local alchemy = require('alchemy'); | |
function split(str, pat) | |
local t = {} | |
local fpat = "(.-)" .. pat | |
local last_end = 1 | |
local s, e, cap = str:find(fpat, 1) | |
while s do | |
if s ~= 1 or cap ~= "" then table.insert(t,cap) end | |
last_end = e+1 | |
s, e, cap = str:find(fpat, last_end) | |
end | |
if last_end <= #str then | |
cap = str:sub(last_end) | |
table.insert(t, cap) | |
end | |
return t | |
end | |
http.createServer(function (req, res) | |
local url = req.url; | |
local cmd = split(url, "/"); | |
local ares = alchemy.call(unpack(cmd)); | |
local body; | |
if (type(ares) == "table") then body = table.concat(ares); | |
else body = ares; end | |
body = body .. "\n"; | |
res:writeHead(200, { | |
["Content-Type"] = "text/plain", | |
["Content-Length"] = string.len(body); | |
}) | |
res:finish(body) | |
end):listen(8080) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server Software: | |
Server Hostname: localhost | |
Server Port: 6379 | |
Document Path: /GET/X | |
Document Length: 7 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 42.112 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 1000000 | |
Total transferred: 69000414 bytes | |
HTML transferred: 7000042 bytes | |
Requests per second: 23746.13 [#/sec] (mean) | |
Time per request: 4.211 [ms] (mean) | |
Time per request: 0.042 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1600.09 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.0 0 3 | |
Processing: 1 4 1.6 4 22 | |
Waiting: 0 4 1.6 4 22 | |
Total: 1 4 1.6 4 22 | |
Percentage of the requests served within a certain time (ms) | |
50% 4 | |
66% 4 | |
75% 4 | |
80% 4 | |
90% 4 | |
95% 5 | |
98% 6 | |
99% 13 | |
100% 22 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server Software: | |
Server Hostname: localhost | |
Server Port: 6379 | |
Document Path: /SET/X/1 | |
Document Length: 5 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 42.314 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 1000000 | |
Total transferred: 67000000 bytes | |
HTML transferred: 5000000 bytes | |
Requests per second: 23632.87 [#/sec] (mean) | |
Time per request: 4.231 [ms] (mean) | |
Time per request: 0.042 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1546.29 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 14 | |
Processing: 1 4 1.6 4 41 | |
Waiting: 1 4 1.6 4 41 | |
Total: 1 4 1.6 4 41 | |
Percentage of the requests served within a certain time (ms) | |
50% 4 | |
66% 4 | |
75% 4 | |
80% 4 | |
90% 4 | |
95% 5 | |
98% 6 | |
99% 13 | |
100% 41 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server Software: Luvit | |
Server Hostname: localhost | |
Server Port: 8080 | |
Document Path: /GET/X | |
Document Length: 2 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 203.341 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 118000118 bytes | |
HTML transferred: 2000002 bytes | |
Requests per second: 4917.85 [#/sec] (mean) | |
Time per request: 20.334 [ms] (mean) | |
Time per request: 0.203 [ms] (mean, across all concurrent requests) | |
Transfer rate: 566.71 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.4 0 7 | |
Processing: 0 20 9.6 20 52 | |
Waiting: 0 20 9.6 20 50 | |
Total: 0 20 9.6 20 52 | |
Percentage of the requests served within a certain time (ms) | |
50% 20 | |
66% 25 | |
75% 28 | |
80% 30 | |
90% 34 | |
95% 35 | |
98% 37 | |
99% 37 | |
100% 52 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Server Software: Luvit | |
Server Hostname: localhost | |
Server Port: 8080 | |
Document Path: /SET/X/1 | |
Document Length: 1 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 205.931 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 117000000 bytes | |
HTML transferred: 1000000 bytes | |
Requests per second: 4855.99 [#/sec] (mean) | |
Time per request: 20.593 [ms] (mean) | |
Time per request: 0.206 [ms] (mean, across all concurrent requests) | |
Transfer rate: 554.83 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.4 0 4 | |
Processing: 0 20 9.7 20 89 | |
Waiting: 0 20 9.7 20 89 | |
Total: 0 21 9.7 20 89 | |
Percentage of the requests served within a certain time (ms) | |
50% 20 | |
66% 26 | |
75% 29 | |
80% 30 | |
90% 34 | |
95% 36 | |
98% 37 | |
99% 37 | |
100% 89 (longest request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== FILE: set_server.lua == | |
local http = require("http"); | |
local alchemy = require('alchemy'); | |
local string = require('string'); | |
http.createServer(function (req, res) | |
alchemy.call("SET", "X", "1"); | |
local body = "SET X to 1\n"; | |
res:writeHead(200, { | |
["Content-Type"] = "text/plain", | |
["Content-Length"] = string.len(body); | |
}) | |
res:finish(body) | |
end):listen(8080) | |
print("SET-Server listening at http://localhost:8080/") | |
== command: taskset -c 0 luvit set_server.lua == | |
== command: taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:8080/SET/X/1" == | |
== RESULTS == | |
Server Software: Luvit | |
Server Hostname: localhost | |
Server Port: 8080 | |
Document Path: /SET/X/1 | |
Document Length: 11 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 203.759 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 128000000 bytes | |
HTML transferred: 11000000 bytes | |
Requests per second: 4907.77 [#/sec] (mean) | |
Time per request: 20.376 [ms] (mean) | |
Time per request: 0.204 [ms] (mean, across all concurrent requests) | |
Transfer rate: 613.47 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.5 0 14 | |
Processing: 0 20 9.4 20 76 | |
Waiting: 0 20 9.4 19 76 | |
Total: 0 20 9.4 20 79 | |
Percentage of the requests served within a certain time (ms) | |
50% 20 | |
66% 25 | |
75% 28 | |
80% 30 | |
90% 33 | |
95% 35 | |
98% 37 | |
99% 40 | |
100% 79 (longest request) | |
== command: taskset -c 0 luvit http-server.lua == | |
== command: taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:8080/SET/X/1" == | |
== RESULTS == | |
Server Software: Luvit | |
Server Hostname: localhost | |
Server Port: 8080 | |
Document Path: /SET/X/1 | |
Document Length: 12 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 105.187 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 0 | |
Total transferred: 129000000 bytes | |
HTML transferred: 12000000 bytes | |
Requests per second: 9506.89 [#/sec] (mean) | |
Time per request: 10.519 [ms] (mean) | |
Time per request: 0.105 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1197.65 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.7 0 21 | |
Processing: 0 10 4.7 10 48 | |
Waiting: 0 10 4.5 10 48 | |
Total: 0 11 4.7 10 49 | |
Percentage of the requests served within a certain time (ms) | |
50% 10 | |
66% 13 | |
75% 14 | |
80% 15 | |
90% 16 | |
95% 18 | |
98% 21 | |
99% 24 | |
100% 49 (longest request) | |
== command: taskset -c 1 ab -n 1000000 -c 100 -k "http://localhost:6379/PING" == | |
== RESULTS == | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 6379 | |
Document Path: /PING | |
Document Length: 7 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 39.590 seconds | |
Complete requests: 1000000 | |
Failed requests: 0 | |
Write errors: 0 | |
Keep-Alive requests: 1000000 | |
Total transferred: 69000069 bytes | |
HTML transferred: 7000007 bytes | |
Requests per second: 25258.58 [#/sec] (mean) | |
Time per request: 3.959 [ms] (mean) | |
Time per request: 0.040 [ms] (mean, across all concurrent requests) | |
Transfer rate: 1702.00 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.1 0 9 | |
Processing: 1 4 2.0 4 59 | |
Waiting: 1 4 2.0 4 59 | |
Total: 1 4 2.0 4 64 | |
Percentage of the requests served within a certain time (ms) | |
50% 4 | |
66% 4 | |
75% 4 | |
80% 4 | |
90% 4 | |
95% 5 | |
98% 9 | |
99% 19 | |
100% 64 (longest request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment