summaryrefslogtreecommitdiff
path: root/caching-tests/bench.lua
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2015-12-23 16:01:51 -0500
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2015-12-23 16:01:51 -0500
commit3d3886672433f0775f772d8d2ee47c5f5e0bc745 (patch)
tree072d171c17d92a6696024256c4b2f5aaa760df35 /caching-tests/bench.lua
parentbf037ce78c2c76a34ecca0fb8bafa5d5be38968a (diff)
parent4be7962adf740a35222bfd99608c04329a802a04 (diff)
Merge branch 'upstream' into dfsg_clean20151220+dfsg
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