Skip to content

Instantly share code, notes, and snippets.

@schfkt
Forked from shyuan/random-path-url.lua
Created May 12, 2020 09:53
Show Gist options
  • Save schfkt/43d61bee62e3d17276fe40ba32c3bf2c to your computer and use it in GitHub Desktop.
Save schfkt/43d61bee62e3d17276fe40ba32c3bf2c to your computer and use it in GitHub Desktop.
Random path benchmark Lua script for wrk
-- https://github.com/wg/wrk
-- wrk -c 1000 -d 10s -s random-path-url.lua http://localhost:8080
local paths = {
"/path1.txt",
"/path2.txt",
"/path3.txt",
"/path4.txt",
"/path5.txt",
"/path6.txt"
}
math.randomseed(os.time())
randomPath = function()
local path = math.random(1,table.getn(paths))
return paths[path]
end
request = function()
path = randomPath()
return wrk.format(nil, path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment