-
Notifications
You must be signed in to change notification settings - Fork 16
Benchmark
重归混沌 edited this page Feb 13, 2020
·
4 revisions
采用redis-benchmark程序来进行并发测试
命令行
redis-benchmark -t ping -p 8000 -c 1000 -n 100000
测试机型
CPU:Intel(R) Core(TM) i5-4440 CPU @ 3.10GHz
测试代码
local core = require "sys.core"
local socket = require "sys.socket"
local listenfd = socket.listen(":8000", function(fd, addr)
while true do
local n = socket.readline(fd)
if not n then
return
end
if n == "PING\r\n" then
socket.write(fd, "+PONG\r\n")
end
end
end)
测试结果
====== PING_INLINE ======
100000 requests completed in 0.76 seconds
1000 parallel clients
3 bytes payload
keep alive: 1
0.00% <= 2 milliseconds
0.03% <= 3 milliseconds
70.15% <= 4 milliseconds
99.35% <= 5 milliseconds
99.70% <= 6 milliseconds
99.98% <= 7 milliseconds
100.00% <= 7 milliseconds
131926.12 requests per second
====== PING_BULK ======
100000 requests completed in 0.77 seconds
1000 parallel clients
3 bytes payload
keep alive: 1
0.00% <= 2 milliseconds
0.08% <= 3 milliseconds
87.33% <= 4 milliseconds
99.45% <= 5 milliseconds
99.76% <= 6 milliseconds
100.00% <= 6 milliseconds
130378.09 requests per second