From 2a58dcb931a4b14be341f8b27c37742a1c060c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20W=C3=BCnsche?= Date: Tue, 9 Apr 2024 15:30:56 +0200 Subject: [PATCH] benchmark: add ycsb-c-esque plot --- .../haura-plots/haura_plots/__init__.py | 2 ++ .../haura-plots/haura_plots/ycsb_plots.py | 23 +++++++++++++++++++ betree/haura-benchmarks/src/ycsb.rs | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py diff --git a/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py b/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py index 4fcac1f3..1aaa3222 100755 --- a/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py +++ b/betree/haura-benchmarks/haura-plots/haura_plots/__init__.py @@ -14,6 +14,7 @@ from . import util from . import metrics_plots from . import cache_plots +from . import ycsb_plots def sort_by_o_id(key): """ @@ -274,6 +275,7 @@ def main(): plot_object_distribution(path) metrics_plots.plot_system(path) cache_plots.plot_cache(data, path) + ycsb_plots.plot_c(path) #plot_filesystem_test() if __name__ == "__main__": diff --git a/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py b/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py new file mode 100644 index 00000000..45aa723f --- /dev/null +++ b/betree/haura-benchmarks/haura-plots/haura_plots/ycsb_plots.py @@ -0,0 +1,23 @@ +import os +import pandas as pd +import matplotlib.pyplot as plt + +def plot_c(path): + if not os.path.exists(f"{path}/ycsb_c.csv"): + return + + data = pd.read_csv(f"{path}/ycsb_c.csv"); + fig, ax = plt.subplots() + # op / s + first = data["ops"][0] / (data["time_ns"][0] / 10**9) + second = data["ops"][1] / (data["time_ns"][1] / 10**9) + if first < second / 2: + first = second / 2 + optimal_scaling = [x * first for x in data["threads"]] + ax.plot(data["threads"], optimal_scaling, linestyle=":", label="Optimal", color='grey') + ax.bar(data["threads"], data["ops"] / (data["time_ns"] / 10**9)) + ax.set_ylabel("Throughput [op/s]") + ax.set_title("YCSB-C Scaling Behavior") + ax.set_xlabel("Threads [#]") + fig.legend() + fig.savefig(f"{path}/ycsb_c.svg") diff --git a/betree/haura-benchmarks/src/ycsb.rs b/betree/haura-benchmarks/src/ycsb.rs index 2c078812..83637ced 100644 --- a/betree/haura-benchmarks/src/ycsb.rs +++ b/betree/haura-benchmarks/src/ycsb.rs @@ -76,8 +76,9 @@ pub fn c(mut client: KvClient, size: u64, threads: usize, runtime: u64) { total += t.join().unwrap(); } let end = start.elapsed(); - w.write_fmt(format_args!("{workers},{total},{}", end.as_nanos())) + w.write_fmt(format_args!("{workers},{total},{}\n", end.as_nanos())) .unwrap(); + w.flush().unwrap(); println!("Achieved: {} ops/sec", total as f32 / end.as_secs_f32()); println!(" {} ns avg", end.as_nanos() / total); }