chore: add benchmarking
parent
62c42331d4
commit
1a8022ab34
19
README.md
19
README.md
|
@ -20,3 +20,22 @@ requesting a redirect. This makes the server very fast.
|
||||||
|
|
||||||
I gave up giving my projects original names a long time ago, so now I just use
|
I gave up giving my projects original names a long time ago, so now I just use
|
||||||
the names of my friends ;p
|
the names of my friends ;p
|
||||||
|
|
||||||
|
## Benchmarking
|
||||||
|
|
||||||
|
I benchmark this tool using the [`wrk2`](https://github.com/giltene/wrk2)
|
||||||
|
utility. I've provided two Lua scripts to aid with this. To bench publishing
|
||||||
|
redirects, use the following:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wrk2 -s bench/post.lua -t 10 -R 10k -d30s -c32 http://localhost:18080
|
||||||
|
```
|
||||||
|
|
||||||
|
And to bench GET requests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wrk2 -s bench/get.lua -t 10 -R 25k -d30s -c32 http://localhost:18080
|
||||||
|
```
|
||||||
|
|
||||||
|
Of course you're free to change the parameters, but the provided Lua files
|
||||||
|
generate URLs that can be used in the benchmark.
|
||||||
|
|
|
@ -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
|
|
@ -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…
Reference in New Issue