Created
August 19, 2016 17:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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