Skip to content

Commit

Permalink
cosbench: use prepare workstage if mode==read cosbench: support mix m…
Browse files Browse the repository at this point in the history
…od Addresses issues #82

Signed-off-by: Tom Deneau <[email protected]>

Closes #83
  • Loading branch information
criptik authored and Mark Nelson committed Feb 19, 2016
1 parent a1ffe15 commit 4e4c8af
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions benchmark/cosbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def choose_template(self, temp_name, conf):
},{
"name": "main",
"work": {"rampup":conf["rampup"], "rampdown":conf["rampdown"], "name":conf["obj_size"], "workers":conf["workers"], "runtime":conf["runtime"],
"operation": {
"operation":[ {
"config":"containers=%s;objects=%s;cprefix=%s-%s;sizes=c(%s)%s" % (conf["containers"], conf["objects"], conf["obj_size"], conf["mode"], conf["obj_size_num"], conf["obj_size_unit"]),
"ratio":conf["ratio"],
"type":conf["mode"]
}
"type":("read" if conf["mode"] == "mix" else conf["mode"])
}]
}
}]
}
Expand Down Expand Up @@ -147,6 +147,29 @@ def initialize(self):
if not self.config["template"]:
self.config["template"] = "default"
self.config["workload"] = self.choose_template("default", conf)

# add a "prepare" stage if mode is read or mix
if (self.mode != "write"):
workstage_prepare= { "name":"prepare",
"work": {
"type":"prepare",
"workers":conf["workers"],
"config":"containers=r(1,%s);objects=r(1,%s);cprefix=%s-%s;sizes=c(%s)%s" %
(conf["containers_max"], conf["objects_max"], conf["obj_size"], conf["mode"], conf["obj_size_num"], conf["obj_size_unit"])
}}
self.config["workload"]["workflow"]["workstage"].insert(1, workstage_prepare)

# add a second (write)operation if mode is "mix"
# parameters same as for read except ratio = 100 - read_ratio
if (self.mode == "mix"):
operation_write = {
"config":"containers=%s;objects=%s;cprefix=%s-%s;sizes=c(%s)%s"
%(conf["containers"], conf["objects"], conf["obj_size"], conf["mode"], conf["obj_size_num"], conf["obj_size_unit"]),
"ratio":(100 - conf["ratio"]),
"type":"write"
}
self.config["workload"]["workflow"]["workstage"][2]["work"]["operation"].append(operation_write)

self.prepare_xml(self.config["workload"])
return True

Expand Down

0 comments on commit 4e4c8af

Please sign in to comment.