finalised script to run benchmark
This commit is contained in:
parent
8c6666a2bb
commit
aeff3d23b8
10 changed files with 500 additions and 3 deletions
55
scripts/fullRun.lua
Normal file
55
scripts/fullRun.lua
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
local proto = { "http://", "https://" }
|
||||
local sizes = { "1kb", "10kb", "100kb", "1000kb" }
|
||||
local testUrl = "test.fluffyb.net"
|
||||
local tcpConnections = 50
|
||||
local testLength = 60 -- in seconds
|
||||
local threads = wrk.thread or 4 -- Defaulting to 4 threads if not specified
|
||||
local testReason = ""
|
||||
|
||||
-- Storage for results
|
||||
local results = {}
|
||||
|
||||
-- Function to run different tests
|
||||
function init(args)
|
||||
results = {}
|
||||
end
|
||||
|
||||
function request()
|
||||
-- Cycle through protocol and size combinations
|
||||
local index = math.random(1, #proto)
|
||||
local sizeIndex = math.random(1, #sizes)
|
||||
local url = proto[index] .. testUrl .. "/" .. sizes[sizeIndex] .. ".file"
|
||||
|
||||
return wrk.format("GET", url)
|
||||
end
|
||||
|
||||
function done(summary, latency, requests)
|
||||
io.write("------------------------------\n")
|
||||
|
||||
-- Print request results
|
||||
for _, p in ipairs({ 50, 90, 99, 99.999 }) do
|
||||
local n = latency:percentile(p)
|
||||
io.write(string.format("%g%%,%d\n", p, n))
|
||||
end
|
||||
|
||||
-- Requests Per Second (RPS)
|
||||
local duration_in_seconds = summary.duration / 1e6
|
||||
local rps = summary.requests / duration_in_seconds
|
||||
io.write(string.format("Requests per second: %.2f\n", rps))
|
||||
|
||||
-- Store results
|
||||
table.insert(results, {
|
||||
reason = testReason,
|
||||
requests = summary.requests,
|
||||
rps = rps,
|
||||
latency_avg = latency.mean / 1000,
|
||||
latency_max = latency.max / 1000
|
||||
})
|
||||
|
||||
-- Print results
|
||||
io.write("\n=== Test Summary ===\n")
|
||||
for _, result in ipairs(results) do
|
||||
io.write(string.format("%s - Requests: %d, RPS: %.2f, Latency (avg): %.2f ms, Latency (max): %.2f ms\n",
|
||||
result.reason, result.requests, result.rps, result.latency_avg, result.latency_max))
|
||||
end
|
||||
end
|
||||
36
scripts/fullrunV2.lua
Normal file
36
scripts/fullrunV2.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
local proto = { "http://", "https://" }
|
||||
local sizes = { "1kb", "10kb", "100kb", "1000kb" }
|
||||
local testUrl = "test.fluffyb.net"
|
||||
|
||||
local current_proto = 1
|
||||
local current_size = 1
|
||||
|
||||
function init(args)
|
||||
current_proto = 1
|
||||
current_size = 1
|
||||
end
|
||||
|
||||
function request()
|
||||
-- Build the URL using the current protocol and file size
|
||||
local url = proto[current_proto] .. testUrl .. "/" .. sizes[current_size] .. ".file"
|
||||
|
||||
-- Move to the next size
|
||||
current_size = current_size + 1
|
||||
|
||||
-- If we've gone through all sizes, move to the next protocol and reset size
|
||||
if current_size > #sizes then
|
||||
current_size = 1
|
||||
current_proto = current_proto + 1
|
||||
end
|
||||
|
||||
-- If we've gone through all protocols, reset everything (looping back)
|
||||
if current_proto > #proto then
|
||||
current_proto = 1
|
||||
end
|
||||
|
||||
return wrk.format("GET", url)
|
||||
end
|
||||
|
||||
function done(summary, latency, requests)
|
||||
io.write(string.format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n\n",latency.min,latency.mean,latency.max,latency.stdev,latency:percentile(50),latency:percentile(70),latency:percentile(90),latency:percentile(99),summary.requests,summary.bytes))
|
||||
end
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
done = function(summary,latency,requests)
|
||||
io.write("------------------------------\n")
|
||||
io.write(string.format("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n\n",latency.min,latency.mean,latency.max,latency.stdev,latency:percentile(50),latency:percentile(70),latency:percentile(90),latency:percentile(99),summary.requests,summary.bytes))
|
||||
io.write(string.format("R: %d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n\n",latency.min,latency.mean,latency.max,latency.stdev,latency:percentile(50),latency:percentile(70),latency:percentile(90),latency:percentile(99),summary.requests,summary.bytes))
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue