Search code examples
testingluaperformance-testingwrk

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


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


Solution

  • I've found out that adding math.randomseed(os.time()), you make sure that the math.random() function generates new random number every time.