Skip to content

Instantly share code, notes, and snippets.

@dead-horse
Last active August 29, 2015 14:04
Show Gist options
  • Save dead-horse/7275f5c03ca71513b7e5 to your computer and use it in GitHub Desktop.
Save dead-horse/7275f5c03ca71513b7e5 to your computer and use it in GitHub Desktop.
local file = io.open("urls.txt", "r");
local arr = {}
local lines = file:lines()
for line in file:lines() do
table.insert (arr, line);
end
local i = 0
request = function()
i = (i % #arr) + 1
return wrk.format(nil, arr[i])
end
done = function(summary, latency, requests)
io.write("------------------------------\n")
for _, p in pairs({ 50, 90, 99, 99.999 }) do
n = latency:percentile(p)
io.write(string.format("%g%%,%d\n", p, n))
end
io.write("-------------------------------\n")
local errors = summary.errors
io.write(string.format("ERRORS:\nconntect:%d, read:%d, write:%d, timeout:%d\n\n", errors.connect, errors.read, errors.read, errors.timeout))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment