Skip to content

Instantly share code, notes, and snippets.

@shyuan
Created November 22, 2016 04:51
Show Gist options
  • Save shyuan/a4f6cc15daa30e101aea798bab4ba791 to your computer and use it in GitHub Desktop.
Save shyuan/a4f6cc15daa30e101aea798bab4ba791 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