From b9521399730082bade35fb2aac7ba2813abdf24d Mon Sep 17 00:00:00 2001 From: Josipmrden Date: Wed, 30 Aug 2023 15:19:52 +0200 Subject: [PATCH] Add supernode performance workload (#1171) --- .github/workflows/daily_benchmark.yaml | 12 +++++-- tests/mgbench/workloads/supernode.py | 43 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/mgbench/workloads/supernode.py diff --git a/.github/workflows/daily_benchmark.yaml b/.github/workflows/daily_benchmark.yaml index 83e2528ce..8d802eb1e 100644 --- a/.github/workflows/daily_benchmark.yaml +++ b/.github/workflows/daily_benchmark.yaml @@ -67,7 +67,9 @@ jobs: - name: Run mgbench run: | cd tests/mgbench - ./benchmark.py vendor-native --num-workers-for-benchmark 12 --export-results benchmark_result.json pokec/medium/*/* + ./benchmark.py vendor-native --num-workers-for-benchmark 12 --export-results benchmark_pokec.json pokec/medium/*/* + + ./benchmark.py vendor-native --num-workers-for-benchmark 1 --export-results benchmark_supernode.json supernode - name: Upload mgbench results run: | @@ -76,7 +78,13 @@ jobs: source ve3/bin/activate pip install -r requirements.txt ./main.py --benchmark-name "mgbench" \ - --benchmark-results-path "../../tests/mgbench/benchmark_result.json" \ + --benchmark-results-path "../../tests/mgbench/benchmark_pokec.json" \ + --github-run-id "${{ github.run_id }}" \ + --github-run-number "${{ github.run_number }}" \ + --head-branch-name "${{ env.BRANCH_NAME }}" + + ./main.py --benchmark-name "supernode" \ + --benchmark-results-path "../../tests/mgbench/benchmark_supernode.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/supernode.py b/tests/mgbench/workloads/supernode.py new file mode 100644 index 000000000..17f476675 --- /dev/null +++ b/tests/mgbench/workloads/supernode.py @@ -0,0 +1,43 @@ +# 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 = "supernode" + CARDINALITY = 50000 + + def indexes_generator(self): + return [ + ("CREATE INDEX ON :Supernode;", {}), + ("CREATE INDEX ON :Supernode(id);", {}), + ("CREATE INDEX ON :Node;", {}), + ("CREATE INDEX ON :Node(id);", {}), + ] + + def dataset_generator(self): + queries = [] + queries.append(("CREATE (:Supernode {id: $id});", {"id": 1})) + for i in range(0, Supernode.CARDINALITY): + queries.append(("CREATE (:Node {id: $id});", {"id": i})) + queries.append(("MATCH (s:Supernode), (n:Node) CREATE (s)<-[:EDGE]-(n)", {})) + + return queries + + def benchmark__test__merge_supernode_edges(self): + return ("MATCH (s:Supernode), (n:Node) MERGE (s)<-[:EDGE]-(n);", {}) + + def benchmark__test__merge_supernode_edges_other_way(self): + return ("MATCH (s:Supernode), (n:Node) MERGE (n)-[:EDGE]->(s);", {}) + + def benchmark__test__unwind_supernode_with_writes(self): + return (f"UNWIND range(1, {Supernode.CARDINALITY}) AS x MATCH (s:Supernode) SET s.prop = x", {})