Created
May 7, 2018 14:37
-
-
Save bmiro/f3beb03b78a7bb82d92b7a26301c815c to your computer and use it in GitHub Desktop.
Lua snippet for wrk to skip caches by adding a querystring
This file contains hidden or 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
-- Lua snippet to use with wrk to test (stress / benchmark) urls skipping CDN / Framework / misc | |
-- cache by adding a 'random' querystring | |
-- | |
-- To use it adjust wrk params and do something like this: | |
-- docker run --rm -v $(pwd)/cache-killer.lua:/cache-killer.lua skandyla/wrk -c 1 -d 1 -t 1 --script /cache-killer.lua http://www.yoursite/testpath | |
request = function() | |
path = wrk.path | |
if path.find(path, "?") then | |
path = path .. "&" | |
else | |
path = path .. "?" | |
end | |
killer = tostring(math.random()) | |
time = tostring(os.time()) | |
path = path .. "cache-killer=" .. killer .. "&" .. time | |
return wrk.format(nil, path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment