chore: add benchmarking
This commit is contained in:
parent
62c42331d4
commit
1a8022ab34
3 changed files with 56 additions and 0 deletions
13
bench/get.lua
Normal file
13
bench/get.lua
Normal 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
24
bench/post.lua
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue