我需要对以参数作为输入的 REST API 进行基准测试。我想知道是否有办法使用wrk
。现在我没有看到这样的选项:
user@Ubuntu-K56CA:~/wrk$ ./wrk
Usage: wrk <options> <url>
Options:
-c, --connections <N> Connections to keep open
-d, --duration <T> Duration of test
-t, --threads <N> Number of threads to use
-s, --script <S> Load Lua script file
-H, --header <H> Add header to request
--latency Print latency statistics
--timeout <T> Socket/request timeout
-v, --version Print version details
当我查看这个文件时:https://github.com/wg/wrk/blob/master/src/wrk.lua https://github.com/wg/wrk/blob/master/src/wrk.lua
我没看到params
任何地方都可以使用。也在摸索params
in wrk
回购没有产生任何有用的东西。
我错过了什么吗?
您可以将其添加到 url 中:
./wrk -c1 -t1 -d5s http://server.com/my_path?param_name=param_value
或者,如果您想在测试期间生成它,您可以使用脚本来完成:
./wrk -t1 -c1 -d5s -s ./scripts/my_script.lua http://server.com
where my_script.lua
is:
request = function()
wrk.headers["Connection"] = "Keep-Alive"
param_value = math.random(1,100)
path = "/my_path?param_name=" .. param_value
return wrk.format("GET", path)
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)