Mercurial > urweb
comparison caching-tests/bench.lua @ 2292:23eaec04e0f8
Ran a benchmark!
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Tue, 17 Nov 2015 04:08:12 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2291:50ad02829abd | 2292:23eaec04e0f8 |
---|---|
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 |