summaryrefslogtreecommitdiff
path: root/caching-tests/bench.lua
blob: 6799ca87d1e877fa95e654b5760377ac2561d67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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