This commit is contained in:
2026-05-26 23:22:32 +02:00
parent 842fca2b72
commit 730de334e0
17 changed files with 5380 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
-- S3 (+S4): 80% GET single / 15% GET list / 5% POST.
-- The mix exposes the store-actor channel round-trip on urus, mutex
-- contention on axum, and gen_server message-pass on cowboy without
-- making writes the bottleneck.
local common = require("common")
wrk.headers = common.headers
wrk.headers["Content-Type"] = "application/json"
math.randomseed(os.time() + os.getpid())
-- A small pool of pre-built JSON bodies. Building one fresh per request
-- in Lua would taint the bench with Lua's GC overhead.
local body_pool = {}
for i = 1, 64 do
body_pool[i] = string.format(
[[{"name":"user%d","email":"u%d@example.test"}]], i, i)
end
request = function()
local r = math.random()
if r < 0.80 then
return wrk.format("GET", "/api/v1/users/" .. math.random(1, 10000))
elseif r < 0.95 then
return wrk.format("GET", "/api/v1/users")
else
local body = body_pool[math.random(1, #body_pool)]
return wrk.format("POST", "/api/v1/users", nil, body)
end
end