我需要对一个将参数作为输入的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
我没有看到params在任何地方被使用。此外,在wrk代码库中对params进行repo不会产生任何有用的结果。
我是不是遗漏了什么?
发布于 2016-03-22 19:13:31
您可以将其添加到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其中,my_script.lua是:
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)
endhttps://stackoverflow.com/questions/33548940
复制相似问题