From fdf63436abeb7b79048f0cc80767eeca03de8c7d Mon Sep 17 00:00:00 2001 From: Josipmrden Date: Tue, 24 Oct 2023 19:44:11 +0200 Subject: [PATCH] Add cartesian and hash join mgbench (#1393) --- .github/workflows/daily_benchmark.yaml | 8 ++++ .github/workflows/performance_benchmarks.yaml | 8 ++++ tests/mgbench/workloads/cartesian.py | 39 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tests/mgbench/workloads/cartesian.py diff --git a/.github/workflows/daily_benchmark.yaml b/.github/workflows/daily_benchmark.yaml index 9581d5e54..681e5a6a5 100644 --- a/.github/workflows/daily_benchmark.yaml +++ b/.github/workflows/daily_benchmark.yaml @@ -73,6 +73,8 @@ jobs: ./benchmark.py vendor-native --num-workers-for-benchmark 1 --export-results benchmark_high_write_set_property.json high_write_set_property + ./benchmark.py vendor-native --num-workers-for-benchmark 12 --export-results cartesian.json cartesian + - name: Upload mgbench results run: | cd tools/bench-graph-client @@ -96,3 +98,9 @@ jobs: --github-run-id "${{ github.run_id }}" \ --github-run-number "${{ github.run_number }}" \ --head-branch-name "${{ env.BRANCH_NAME }}" + + ./main.py --benchmark-name "cartesian" \ + --benchmark-results-path "../../tests/mgbench/cartesian.json" \ + --github-run-id "${{ github.run_id }}" \ + --github-run-number "${{ github.run_number }}" \ + --head-branch-name "${{ env.BRANCH_NAME }}" diff --git a/.github/workflows/performance_benchmarks.yaml b/.github/workflows/performance_benchmarks.yaml index a52d6d587..29b227556 100644 --- a/.github/workflows/performance_benchmarks.yaml +++ b/.github/workflows/performance_benchmarks.yaml @@ -52,6 +52,8 @@ jobs: ./benchmark.py vendor-native --num-workers-for-benchmark 1 --export-results benchmark_high_write_set_property.json high_write_set_property + ./benchmark.py vendor-native --num-workers-for-benchmark 12 --export-results benchmark_cartesian.json cartesian + - name: Upload benchmark results run: | cd tools/bench-graph-client @@ -75,3 +77,9 @@ jobs: --github-run-id "${{ github.run_id }}" \ --github-run-number "${{ github.run_number }}" \ --head-branch-name "${{ env.BRANCH_NAME }}" + + ./main.py --benchmark-name "cartesian" \ + --benchmark-results-path "../../tests/mgbench/cartesian.json" \ + --github-run-id "${{ github.run_id }}" \ + --github-run-number "${{ github.run_number }}" \ + --head-branch-name "${{ env.BRANCH_NAME }}" diff --git a/tests/mgbench/workloads/cartesian.py b/tests/mgbench/workloads/cartesian.py new file mode 100644 index 000000000..caa7598b7 --- /dev/null +++ b/tests/mgbench/workloads/cartesian.py @@ -0,0 +1,39 @@ +# Copyright 2023 Memgraph Ltd. +# +# Use of this software is governed by the Business Source License +# included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source +# License, and you may not use this file except in compliance with the Business Source License. +# +# As of the Change Date specified in that file, in accordance with +# the Business Source License, use of this software will be governed +# by the Apache License, Version 2.0, included in the file +# licenses/APL.txt. + +from workloads.base import Workload + + +class Supernode(Workload): + NAME = "cartesian" + CARDINALITY = 1000 + + def indexes_generator(self): + return [ + ("CREATE INDEX ON :Node;", {}), + ("CREATE INDEX ON :Node(id);", {}), + ] + + def dataset_generator(self): + queries = [] + for i in range(0, Supernode.CARDINALITY): + queries.append(("CREATE (:Node {id: $id, id2: $id});", {"id": i, "id2": i})) + + return queries + + def benchmark__test__plain_cartesian_filtering(self): + return ("MATCH (n1:Node), (n2:Node) WHERE n1.id < 100 and n2.id < 100 RETURN n1, n2;", {}) + + def benchmark__test__plain_cartesian_join(self): + return ("MATCH (n1:Node), (n2:Node) WHERE n1.id = n2.id RETURN n1, n2;", {}) + + def benchmark__test__plain_cartesian_different_props_join(self): + return ("MATCH (n1:Node), (n2:Node) WHERE n1.id = n2.id2 RETURN n1, n2;", {})