comparison caching-tests/bench.lua @ 2304:6fb9232ade99

Merge Sqlcache
author Adam Chlipala <adam@chlipala.net>
date Sun, 20 Dec 2015 14:18:52 -0500
parents 23eaec04e0f8
children
comparison
equal deleted inserted replaced
2201:1091227f535a 2304:6fb9232ade99
1 math.randomseed(os.time())
2
3 p = 0.25
4 n = 2000
5
6 function init(args)
7 if args[1] then
8 p = tonumber(args[1])
9 end
10 if args[2] then
11 n = tonumber(args[2])
12 end
13 end
14
15 function request()
16 path = "/Bench/"
17 if math.random() < p then
18 path = path .. "flush"
19 else
20 path = path .. "check"
21 end
22 id = math.random(n)
23 path = path .. "/" .. id
24 return wrk.format(nil, path)
25 end