From eb5167dfef208b9db7ed715a1f7c5c6cd4213e53 Mon Sep 17 00:00:00 2001 From: Josipmrden Date: Thu, 31 Aug 2023 14:46:35 +0200 Subject: [PATCH] Add high write set property workload (#1172) --- .github/workflows/daily_benchmark.yaml | 8 +++ .../workloads/high_write_set_property.py | 72 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/mgbench/workloads/high_write_set_property.py diff --git a/.github/workflows/daily_benchmark.yaml b/.github/workflows/daily_benchmark.yaml index 8d802eb1e..9581d5e54 100644 --- a/.github/workflows/daily_benchmark.yaml +++ b/.github/workflows/daily_benchmark.yaml @@ -71,6 +71,8 @@ jobs: ./benchmark.py vendor-native --num-workers-for-benchmark 1 --export-results benchmark_supernode.json supernode + ./benchmark.py vendor-native --num-workers-for-benchmark 1 --export-results benchmark_high_write_set_property.json high_write_set_property + - name: Upload mgbench results run: | cd tools/bench-graph-client @@ -88,3 +90,9 @@ jobs: --github-run-id "${{ github.run_id }}" \ --github-run-number "${{ github.run_number }}" \ --head-branch-name "${{ env.BRANCH_NAME }}" + + ./main.py --benchmark-name "high_write_set_property" \ + --benchmark-results-path "../../tests/mgbench/benchmark_high_write_set_property.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/high_write_set_property.py b/tests/mgbench/workloads/high_write_set_property.py new file mode 100644 index 000000000..098aa01ea --- /dev/null +++ b/tests/mgbench/workloads/high_write_set_property.py @@ -0,0 +1,72 @@ +# 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 HighWriteSetProperty(Workload): + NAME = "high_write_set_property" + CARDINALITY = 100000 + + def indexes_generator(self): + return [ + ("CREATE INDEX ON :Node;", {}), + ("CREATE INDEX ON :Node(prop1);", {}), + ("CREATE INDEX ON :Node(prop2);", {}), + ("CREATE INDEX ON :Node(prop3);", {}), + ("CREATE INDEX ON :Node(prop4);", {}), + ("CREATE INDEX ON :Node(prop5);", {}), + ("CREATE INDEX ON :Node(prop6);", {}), + ("CREATE INDEX ON :Node(prop7);", {}), + ("CREATE INDEX ON :Node(prop8);", {}), + ("CREATE INDEX ON :Node(prop9);", {}), + ("CREATE INDEX ON :Node(prop10);", {}), + ("CREATE INDEX ON :Node(prop11);", {}), + ("CREATE INDEX ON :Node(prop12);", {}), + ("CREATE INDEX ON :Node(prop13);", {}), + ("CREATE INDEX ON :Node(prop14);", {}), + ("CREATE INDEX ON :Node(prop15);", {}), + ("CREATE INDEX ON :Node(prop16);", {}), + ("CREATE INDEX ON :Node(prop17);", {}), + ("CREATE INDEX ON :Node(prop18);", {}), + ("CREATE INDEX ON :Node(prop19);", {}), + ("CREATE INDEX ON :Node(prop20);", {}), + ] + + def dataset_generator(self): + queries = [] + for i in range(0, HighWriteSetProperty.CARDINALITY): + queries.append( + ( + """CREATE +(:Node {prop1: $id, prop2: $id, prop3: $id, +prop4: $id, prop5: $id, prop6: $id, prop7: $id, prop8: $id, +prop9: $id, prop10: $id, prop11: $id, prop12: $id, prop13: $id, +prop14: $id, prop15: $id, prop16: $id, prop17: $id, prop18: $id, +prop19: $id, prop20: $id}); +""", + {"id": i}, + ) + ) + + return queries + + def benchmark__test__write_20_attributes_set_property(self): + return ( + "MATCH (n:Node) SET n.prop1 = n.prop2, n.prop2 = n.prop3, n.prop3 = n.prop4, n.prop4 = n.prop5, n.prop5 = n.prop6, n.prop6 = n.prop7, n.prop7 = n.prop8, n.prop8 = n.prop9, n.prop9 = n.prop10, n.prop10 = n.prop11, n.prop11 = n.prop12, n.prop12 = n.prop13, n.prop13 = n.prop14, n.prop14 = n.prop15, n.prop15 = n.prop16, n.prop16 = n.prop17, n.prop17 = n.prop18, n.prop18 = n.prop19, n.prop19 = n.prop20, n.prop20 = n.prop1;", + {}, + ) + + def benchmark__test__write_20_attributes_set_properties(self): + return ( + "MATCH (n:Node) SET n += {prop1: n.prop2, prop2: n.prop3, prop3: n.prop4, prop4: n.prop5, prop5: n.prop6, prop6: n.prop7, prop7: n.prop8, prop8: n.prop9, prop9: n.prop10, prop10: n.prop11, prop11: n.prop12, prop12: n.prop13, prop13: n.prop14, prop14: n.prop15, prop15: n.prop16, prop16: n.prop17, prop17: n.prop18, prop18: n.prop19, prop19: n.prop20, prop20: n.prop1};", + {}, + )