diff --git a/experiments/nexmark/Dockerfile b/experiments/nexmark/Dockerfile index d253cdb..150c810 100644 --- a/experiments/nexmark/Dockerfile +++ b/experiments/nexmark/Dockerfile @@ -18,7 +18,7 @@ RUN wget https://downloads.apache.org/flink/flink-1.18.1/flink-1.18.1-bin-scala_ ENV PATH="/opt/flink/bin:${PATH}" # Set the environment variable for JAVA_HOME -RUN JAVA_HOME="$(dirname $(dirname $(update-alternatives --list | head -n 1)) | tail -1)" +RUN JAVA_HOME="$(dirname $(dirname $(update-alternatives --list java | head -n 1)) | tail -1)" # Install Python dependencies RUN pip install matplotlib numpy @@ -26,7 +26,7 @@ RUN pip install matplotlib numpy # Cleanup RUN apt-get clean -# Copy the Flink and Shark source code into the image +# Copy the Flink and Rust source code into the image COPY . . # Copy Flink configuration diff --git a/experiments/nexmark/README.md b/experiments/nexmark/README.md index eb16a6b..6fdba60 100644 --- a/experiments/nexmark/README.md +++ b/experiments/nexmark/README.md @@ -1,6 +1,6 @@ # Nexmark Benchmark -This directory contains the Nexmark benchmark implemented for Aqua, targeting Shark and Flink. +This directory contains the Nexmark benchmark implemented for Aqua, targeting Flink and Rust. The benchmark contains 2 experiments: * Experiment 1: The 8 standard Nexmark Queries. diff --git a/experiments/nexmark/queries/shark/Cargo.lock b/experiments/nexmark/queries/rust/Cargo.lock similarity index 99% rename from experiments/nexmark/queries/shark/Cargo.lock rename to experiments/nexmark/queries/rust/Cargo.lock index 16e4d3e..ac0ca7c 100644 --- a/experiments/nexmark/queries/shark/Cargo.lock +++ b/experiments/nexmark/queries/rust/Cargo.lock @@ -654,6 +654,18 @@ dependencies = [ "tracing", ] +[[package]] +name = "rust-nexmark" +version = "0.0.0" +dependencies = [ + "csv", + "memmap2", + "nexmark", + "runtime", + "smartstring", + "smol_str", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -709,18 +721,6 @@ dependencies = [ "serde", ] -[[package]] -name = "shark-nexmark" -version = "0.0.0" -dependencies = [ - "csv", - "memmap2", - "nexmark", - "runtime", - "smartstring", - "smol_str", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" diff --git a/experiments/nexmark/queries/shark/Cargo.toml b/experiments/nexmark/queries/rust/Cargo.toml similarity index 93% rename from experiments/nexmark/queries/shark/Cargo.toml rename to experiments/nexmark/queries/rust/Cargo.toml index 3f72a81..c6fbfa4 100644 --- a/experiments/nexmark/queries/shark/Cargo.toml +++ b/experiments/nexmark/queries/rust/Cargo.toml @@ -1,7 +1,7 @@ [workspace] [package] -name = "shark-nexmark" +name = "rust-nexmark" version = "0.0.0" edition = "2021" diff --git a/experiments/nexmark/queries/shark/src/data.rs b/experiments/nexmark/queries/rust/src/data.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/data.rs rename to experiments/nexmark/queries/rust/src/data.rs diff --git a/experiments/nexmark/queries/shark/src/main.rs b/experiments/nexmark/queries/rust/src/main.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/main.rs rename to experiments/nexmark/queries/rust/src/main.rs diff --git a/experiments/nexmark/queries/shark/src/q1.rs b/experiments/nexmark/queries/rust/src/q1.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q1.rs rename to experiments/nexmark/queries/rust/src/q1.rs diff --git a/experiments/nexmark/queries/shark/src/q2.rs b/experiments/nexmark/queries/rust/src/q2.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q2.rs rename to experiments/nexmark/queries/rust/src/q2.rs diff --git a/experiments/nexmark/queries/shark/src/q3.rs b/experiments/nexmark/queries/rust/src/q3.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q3.rs rename to experiments/nexmark/queries/rust/src/q3.rs diff --git a/experiments/nexmark/queries/shark/src/q4.rs b/experiments/nexmark/queries/rust/src/q4.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q4.rs rename to experiments/nexmark/queries/rust/src/q4.rs diff --git a/experiments/nexmark/queries/shark/src/q5.rs b/experiments/nexmark/queries/rust/src/q5.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q5.rs rename to experiments/nexmark/queries/rust/src/q5.rs diff --git a/experiments/nexmark/queries/shark/src/q6.rs b/experiments/nexmark/queries/rust/src/q6.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q6.rs rename to experiments/nexmark/queries/rust/src/q6.rs diff --git a/experiments/nexmark/queries/shark/src/q7.rs b/experiments/nexmark/queries/rust/src/q7.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q7.rs rename to experiments/nexmark/queries/rust/src/q7.rs diff --git a/experiments/nexmark/queries/shark/src/q8.rs b/experiments/nexmark/queries/rust/src/q8.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/q8.rs rename to experiments/nexmark/queries/rust/src/q8.rs diff --git a/experiments/nexmark/queries/shark/src/qw.rs b/experiments/nexmark/queries/rust/src/qw.rs similarity index 100% rename from experiments/nexmark/queries/shark/src/qw.rs rename to experiments/nexmark/queries/rust/src/qw.rs diff --git a/experiments/nexmark/run.py b/experiments/nexmark/run.py index 503f205..b0e315d 100644 --- a/experiments/nexmark/run.py +++ b/experiments/nexmark/run.py @@ -14,7 +14,7 @@ num_iterations = 10 flink = ['flink', 'run', 'queries/flink/target/flink-nexmark-1.0-SNAPSHOT.jar'] -shark = ['./queries/shark/target/release/shark-nexmark'] +rust = ['./queries/rust/target/release/rust-nexmark'] def json_path(n): @@ -52,7 +52,7 @@ def setup(): # Build Rust project subprocess.run(['cargo', 'build', '--release', - '--manifest-path=queries/shark/Cargo.toml']) + '--manifest-path=queries/rust/Cargo.toml']) # Build Java project subprocess.run(['mvn', 'clean', 'package', '-f', 'queries/flink/pom.xml']) @@ -141,47 +141,47 @@ def f(program, query, data): obj = { 'Q1': { 'Flink': f(flink, 'q1', generate('b')), - 'Shark': f(shark, 'q1', generate('b')) + 'Rust': f(rust, 'q1', generate('b')) }, 'Q2': { 'Flink': f(flink, 'q2', generate('b')), - 'Shark': f(shark, 'q2', generate('b')), + 'Rust': f(rust, 'q2', generate('b')), }, 'Q3': { 'Flink': f(flink, 'q3', generate('ap')), - 'Shark': f(shark, 'q3', generate('ap')), + 'Rust': f(rust, 'q3', generate('ap')), 'FlinkOpt': f(flink, 'q3-opt', generate('ap')), - 'SharkOpt': f(shark, 'q3-opt', generate('ap')) + 'RustOpt': f(rust, 'q3-opt', generate('ap')) }, 'Q4': { 'Flink': f(flink, 'q4', generate('ab')), - 'Shark': f(shark, 'q4', generate('ab')), + 'Rust': f(rust, 'q4', generate('ab')), 'FlinkOpt': f(flink, 'q4-opt', generate('ab')), - 'SharkOpt': f(shark, 'q4-opt', generate('ab')) + 'RustOpt': f(rust, 'q4-opt', generate('ab')) }, 'Q5': { 'Flink': f(flink, 'q5', generate('b')), - 'Shark': f(shark, 'q5', generate('b')), + 'Rust': f(rust, 'q5', generate('b')), 'FlinkOpt': f(flink, 'q5-opt', generate('b')), - 'SharkOpt': f(shark, 'q5-opt', generate('b')) + 'RustOpt': f(rust, 'q5-opt', generate('b')) }, 'Q6': { 'Flink': f(flink, 'q6', generate('ab')), - 'Shark': f(shark, 'q6', generate('ab')), + 'Rust': f(rust, 'q6', generate('ab')), 'FlinkOpt': f(flink, 'q6-opt', generate('ab')), - 'SharkOpt': f(shark, 'q6-opt', generate('ab')) + 'RustOpt': f(rust, 'q6-opt', generate('ab')) }, 'Q7': { 'Flink': f(flink, 'q7', generate('b')), - 'Shark': f(shark, 'q7', generate('b')), + 'Rust': f(rust, 'q7', generate('b')), 'FlinkOpt': f(flink, 'q7-opt', generate('b')), - 'SharkOpt': f(shark, 'q7-opt', generate('b')) + 'RustOpt': f(rust, 'q7-opt', generate('b')) }, 'Q8': { 'Flink': f(flink, 'q8', generate('ap')), - 'Shark': f(shark, 'q8', generate('ap')), + 'Rust': f(rust, 'q8', generate('ap')), 'FlinkOpt': f(flink, 'q8-opt', generate('ap')), - 'SharkOpt': f(shark, 'q8-opt', generate('ap')) + 'RustOpt': f(rust, 'q8-opt', generate('ap')) } } write(json_path(1), obj) @@ -197,25 +197,25 @@ def f(program, size, query): obj = { 'Size 100': { 'Flink': f(flink, '100', 'qw'), - 'Shark': f(shark, '100', 'qw'), + 'Rust': f(rust, '100', 'qw'), 'FlinkOpt': f(flink, '100', 'qw-opt'), - 'SharkOpt': f(shark, '100', 'qw-opt'), + 'RustOpt': f(rust, '100', 'qw-opt'), }, 'Size 1000': { 'Flink': f(flink, '1000', 'qw'), - 'Shark': f(shark, '1000', 'qw'), + 'Rust': f(rust, '1000', 'qw'), 'FlinkOpt': f(flink, '1000', 'qw-opt'), - 'SharkOpt': f(shark, '1000', 'qw-opt'), + 'RustOpt': f(rust, '1000', 'qw-opt'), }, 'Size 10000': { 'Flink': f(flink, '10000', 'qw'), - 'Shark': f(shark, '10000', 'qw'), + 'Rust': f(rust, '10000', 'qw'), 'FlinkOpt': f(flink, '10000', 'qw-opt'), - 'SharkOpt': f(shark, '10000', 'qw-opt'), + 'RustOpt': f(rust, '10000', 'qw-opt'), }, 'Size 100000': { - 'Shark': f(shark, '100000', 'qw'), - 'SharkOpt': f(shark, '100000', 'qw-opt'), + 'Rust': f(rust, '100000', 'qw'), + 'RustOpt': f(rust, '100000', 'qw-opt'), } } write(json_path(2), obj) @@ -228,7 +228,7 @@ def plot(result_json_path, plot_path, tex=False, io=False): SMALL_SIZE = 8 MEDIUM_SIZE = 10 - BIGGER_SIZE = 12 + BIGGER_SIZE = 10 plt.rc('font', size=SMALL_SIZE) plt.rc('axes', titlesize=SMALL_SIZE) @@ -244,14 +244,14 @@ def plot(result_json_path, plot_path, tex=False, io=False): plt.rcParams["font.family"] = "serif" plt.rcParams["font.size"] = "8" - fig, ax = plt.subplots(figsize=(10/3, 2.5)) + fig, ax = plt.subplots(figsize=(10/3, 1.8)) ax.yaxis.set_major_formatter(FormatStrFormatter('%.0f')) ax.set_ylim([0, ymax * 1.1]) bar_width = 0.2 - system_names = ['Flink', 'Shark', 'FlinkOpt', 'SharkOpt'] + system_names = ['Flink', 'Rust', 'FlinkOpt', 'RustOpt'] colors = plt.cm.Accent(np.linspace(0, 0.5, len(system_names))) color_map = dict(zip(system_names, colors)) @@ -284,7 +284,7 @@ def plot(result_json_path, plot_path, tex=False, io=False): ax.set_xticks(np.arange(len(obj))) ax.set_xticklabels(obj.keys()) - ax.set_ylabel('Execution Time (seconds)') + ax.set_ylabel('Execution Time (s)') handles = [Patch( label=system, @@ -318,6 +318,7 @@ def plot_experiment1(tex=False): def plot_experiment2(twocolumn=False, tex=False): + plot(json_path(2), pdf_path(2, io=True), tex=tex, io=True) plot(json_path(2), pdf_path(2, io=False), tex=tex, io=False)