summaryrefslogtreecommitdiff
path: root/caching-tests/bench.lua
diff options
context:
space:
mode:
Diffstat (limited to 'caching-tests/bench.lua')
-rw-r--r--caching-tests/bench.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/caching-tests/bench.lua b/caching-tests/bench.lua
new file mode 100644
index 00000000..6799ca87
--- /dev/null
+++ b/caching-tests/bench.lua
@@ -0,0 +1,25 @@
+math.randomseed(os.time())
+
+p = 0.25
+n = 2000
+
+function init(args)
+ if args[1] then
+ p = tonumber(args[1])
+ end
+ if args[2] then
+ n = tonumber(args[2])
+ end
+end
+
+function request()
+ path = "/Bench/"
+ if math.random() < p then
+ path = path .. "flush"
+ else
+ path = path .. "check"
+ end
+ id = math.random(n)
+ path = path .. "/" .. id
+ return wrk.format(nil, path)
+end