Skip to content

Instantly share code, notes, and snippets.

@abelyansky
Created August 19, 2016 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abelyansky/d79c298cf0ba66ba4985d3fadd43697f to your computer and use it in GitHub Desktop.
Save abelyansky/d79c298cf0ba66ba4985d3fadd43697f to your computer and use it in GitHub Desktop.
small wrk2 plugin to generate load using a file of sampled, base64 encoded cookies
mime = require('mime')
wrk.method = "POST"
wrk.headers["Content-type"] = "application/x-protobuf"
requests = {}
init = function(args)
io.input('/home/centos/cookies_small')
for line in io.lines() do
actor = mime.unb64(line)
table.insert(requests, wrk.format(wrk.method, nil, wrk.headers, actor))
end
end
request = function()
local ind = math.random(table.getn(requests))
return requests[ind]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment