How can I be sure that wrk is targeting different profile ids?

时间:2017-07-12 08:11:24

标签: testing lua performance-testing wrk

I'm doing performance testing and using wrk for the first time. My goal is to send requests to different profile ids because I suspect the platform being tested caches same request so that response times improve. URL looks something like this:

http://some_url:some_port/cxs/profiles/...

Made a LUA script to randomize profile ids that looks like this:

request = function()   
return wrk.format(nil, string.format("/cxs/profiles/%012d", math.random(100000000)))
end

and my wrk request looks like this:

 wrk -t3 -c8 -d15m -H "Authorization: Basic a2FyYWY6a2FyYWY=" -s myScript.lua "http://some_url:some_port" --latency 

Is there a way to be sure that wrk is really targeting different profile ids? Because the response time doesn't change a lot without the script

1 个答案:

答案 0 :(得分:0)

我发现添加math.randomseed(os.time()),确保math.random()函数每次都会生成新的随机数。