chore: add benchmarking

This commit is contained in:
Jef Roosens 2023-05-31 20:39:06 +02:00
parent 62c42331d4
commit 1a8022ab34
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
3 changed files with 56 additions and 0 deletions

13
bench/get.lua Normal file
View file

@ -0,0 +1,13 @@
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
request = function()
path = "/"
for i = 1,4 do
local rint = math.random(1, #chars)
path = path .. chars:sub(rint, rint)
end
return wrk.format(nil, path)
end

24
bench/post.lua Normal file
View file

@ -0,0 +1,24 @@
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
request = function()
path = "/s/"
-- for i = 1,16 do
-- local rint = math.random(1, #chars)
-- path = path .. chars:sub(rint, rint)
-- end
body = "https://example.com/"
for i = 1,32 do
local rint = math.random(1, #chars)
body = body .. chars:sub(rint, rint)
end
wrk.path = path
wrk.method = "POST"
wrk.body = body
wrk.headers["X-Api-Key"] = "test"
return wrk.format()
end