From 3133cafa7c66cac38342d616704c417f3170cd24 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 3 Jan 2024 11:48:32 -0500 Subject: [PATCH 1/5] Remove unused variables Signed-off-by: Florent Poinsard --- go/tools/macrobench/types.go | 5 -- go/tools/macrobench/types_test.go | 81 ------------------------------- 2 files changed, 86 deletions(-) delete mode 100644 go/tools/macrobench/types_test.go diff --git a/go/tools/macrobench/types.go b/go/tools/macrobench/types.go index 2a7540c13..0d5818ce3 100644 --- a/go/tools/macrobench/types.go +++ b/go/tools/macrobench/types.go @@ -27,11 +27,6 @@ type ( Type string ) -const ( - OLTP = Type("oltp") - TPCC = Type("tpcc") -) - // Type implements Cobra flag.Value interface. func (mbtype *Type) Type() string { return "Type" diff --git a/go/tools/macrobench/types_test.go b/go/tools/macrobench/types_test.go deleted file mode 100644 index 574af565a..000000000 --- a/go/tools/macrobench/types_test.go +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Copyright 2021 The Vitess Authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * / - */ - -package macrobench - -import ( - qt "github.com/frankban/quicktest" - "testing" -) - -func TestMacroBenchmarkType_String(t *testing.T) { - tests := []struct { - name string - mbtype Type - want string - }{ - {name: "String TPCC", mbtype: TPCC, want: string(TPCC)}, - {name: "String OLTP", mbtype: OLTP, want: string(OLTP)}, - {name: "Simple string", mbtype: "simple", want: "simple"}, - {name: "Empty string", mbtype: "", want: ""}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := qt.New(t) - c.Assert(tt.mbtype.String(), qt.Equals, tt.want) - }) - } -} - -func TestMacroBenchmarkType_ToUpper(t *testing.T) { - tests := []struct { - name string - mbtype Type - want Type - }{ - {name: "String TPCC", mbtype: TPCC, want: Type("TPCC")}, - {name: "String OLTP", mbtype: OLTP, want: Type("OLTP")}, - {name: "Simple string", mbtype: "simple", want: Type("SIMPLE")}, - {name: "Empty string", mbtype: "", want: Type("")}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := qt.New(t) - c.Assert(tt.mbtype.ToUpper(), qt.Equals, tt.want) - }) - } -} - -func TestMacroBenchmarkType_Set(t *testing.T) { - tests := []struct { - name string - mbtype Type - s string - want Type - }{ - {name: "Simple string", mbtype: "", s: "TPCC", want: Type("TPCC")}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - c := qt.New(t) - err := tt.mbtype.Set(tt.s) - c.Assert(err, qt.IsNil) - c.Assert(tt.mbtype, qt.Equals, tt.want) - }) - } -} From 4b2444a6b7fe6a2f5744d2722f0071711593e1dc Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 3 Jan 2024 12:19:50 -0500 Subject: [PATCH 2/5] Add the tpcc_fk benchmark to the list of benchmarks Signed-off-by: Florent Poinsard --- ansible/vitess-benchmark/tpcc_fk_vschema.json | 83 +++++++++++++++++++ ansible/vitess-benchmark/tpcc_vschema.json | 2 +- config/benchmarks/tpcc_fk.yaml | 42 ++++++++++ config/dev/config.yaml | 2 +- go/server/server.go | 13 +-- 5 files changed, 134 insertions(+), 8 deletions(-) create mode 100644 ansible/vitess-benchmark/tpcc_fk_vschema.json create mode 100644 config/benchmarks/tpcc_fk.yaml diff --git a/ansible/vitess-benchmark/tpcc_fk_vschema.json b/ansible/vitess-benchmark/tpcc_fk_vschema.json new file mode 100644 index 000000000..73f4ef26b --- /dev/null +++ b/ansible/vitess-benchmark/tpcc_fk_vschema.json @@ -0,0 +1,83 @@ +{ + "sharded": true, + "vindexes": { + "hash": { + "type": "hash" + } + }, + "tables": { + "customer1": { + "column_vindexes": [ + { + "column": "c_w_id", + "name": "hash" + } + ] + }, + "district1": { + "column_vindexes": [ + { + "column": "d_w_id", + "name": "hash" + } + ] + }, + "history1": { + "column_vindexes": [ + { + "column": "h_w_id", + "name": "hash" + } + ] + }, + "item1": { + "column_vindexes": [ + { + "column": "i_id", + "name": "hash" + } + ] + }, + "new_orders1": { + "column_vindexes": [ + { + "column": "no_w_id", + "name": "hash" + } + ] + }, + "order_line1": { + "column_vindexes": [ + { + "column": "ol_w_id", + "name": "hash" + } + ] + }, + "orders1": { + "column_vindexes": [ + { + "column": "o_w_id", + "name": "hash" + } + ] + }, + "stock1": { + "column_vindexes": [ + { + "column": "s_w_id", + "name": "hash" + } + ] + }, + "warehouse1": { + "column_vindexes": [ + { + "column": "w_id", + "name": "hash" + } + ] + } + } +} + diff --git a/ansible/vitess-benchmark/tpcc_vschema.json b/ansible/vitess-benchmark/tpcc_vschema.json index 388063458..73f4ef26b 100644 --- a/ansible/vitess-benchmark/tpcc_vschema.json +++ b/ansible/vitess-benchmark/tpcc_vschema.json @@ -78,6 +78,6 @@ } ] } - } + } } diff --git a/config/benchmarks/tpcc_fk.yaml b/config/benchmarks/tpcc_fk.yaml new file mode 100644 index 000000000..0dfffdc68 --- /dev/null +++ b/config/benchmarks/tpcc_fk.yaml @@ -0,0 +1,42 @@ +## Exec configuration +exec-type: tpcc_fk +exec-schema: "./vitess-benchmark/tpcc_fk_vschema.json" + +## Ansible +ansible-inventory-file: macrobench_sharded_inventory.yml +ansible-playbook-file: macrobench.yml + +## Macrobench cmd +macrobench-sysbench-executable: /usr/local/bin/sysbench +macrobench-workload-path: /src/sysbench-tpcc/tpcc.lua +macrobench-skip-steps: +macrobench-type: tpcc +macrobench-working-directory: /src/sysbench-tpcc + +## Sysbench all steps +macrobench_all_mysql-db: main +macrobench_all_mysql-host: 127.0.0.1 +macrobench_all_mysql-port: 13306 +macrobench_all_db-ps-mode: disable +macrobench_all_db-driver: mysql +macrobench_all_luajit-cmd: "off" +macrobench_all_threads: 42 +macrobench_all_tables: 1 +macrobench_all_scale: 1 +macrobench_all_rand-type: uniform +macrobench_all_rand-seed: 1 +macrobench_all_use_fk: 1 +macrobench_all_mysql-ignore-errors: all + +## Sysbench prepare step +macrobench_prepare_time: 60 +macrobench_prepare_report-interval: 10 + +## Sysbench warm up step +macrobench_warmup_time: 60 +macrobench_warmup_report-interval: 10 + +## Sysbench run step +macrobench_run_time: 600 +macrobench_run_report_json: "yes" +macrobench_run_verbosity: 0 \ No newline at end of file diff --git a/config/dev/config.yaml b/config/dev/config.yaml index 5c6b39b94..5bf151237 100644 --- a/config/dev/config.yaml +++ b/config/dev/config.yaml @@ -7,7 +7,7 @@ web-pr-label-trigger: '"Benchmark me"' web-pr-label-trigger-planner-v3: '"Benchmark me (V3)"' web-vitess-path: /tmp web-mode: "development" -web-cron-schedule: "1 1 1 1 1" +web-cron-schedule: "*/1 * * * *" web-cron-schedule-pull-requests: "1 1 1 1 1" web-cron-schedule-tags: "1 1 1 1 1" diff --git a/go/server/server.go b/go/server/server.go index 26e04294d..52f597f7b 100644 --- a/go/server/server.go +++ b/go/server/server.go @@ -174,16 +174,17 @@ func (s *Server) Init() error { } s.benchmarkConfig = map[string]benchmarkConfig{ - "micro": {file: path.Join(s.benchmarkConfigPath, "micro.yaml"), v: viper.New(), skip: true}, - "oltp": {file: path.Join(s.benchmarkConfigPath, "oltp.yaml"), v: viper.New()}, - "oltp-set": {file: path.Join(s.benchmarkConfigPath, "oltp-set.yaml"), v: viper.New()}, - "oltp-readonly": {file: path.Join(s.benchmarkConfigPath, "oltp-readonly.yaml"), v: viper.New()}, + // "micro": {file: path.Join(s.benchmarkConfigPath, "micro.yaml"), v: viper.New(), skip: true}, + // "oltp": {file: path.Join(s.benchmarkConfigPath, "oltp.yaml"), v: viper.New()}, + // "oltp-set": {file: path.Join(s.benchmarkConfigPath, "oltp-set.yaml"), v: viper.New()}, + // "oltp-readonly": {file: path.Join(s.benchmarkConfigPath, "oltp-readonly.yaml"), v: viper.New()}, // TODO: oltp-readonly-olap benchmarks are skipped for now as they fail very often due to // MySQL connections being dropped. This issue will be investigated soon. - "oltp-readonly-olap": {file: path.Join(s.benchmarkConfigPath, "olap-readonly.yaml"), v: viper.New(), skip: true}, + // "oltp-readonly-olap": {file: path.Join(s.benchmarkConfigPath, "olap-readonly.yaml"), v: viper.New(), skip: true}, - "tpcc": {file: path.Join(s.benchmarkConfigPath, "tpcc.yaml"), v: viper.New()}, + // "tpcc": {file: path.Join(s.benchmarkConfigPath, "tpcc.yaml"), v: viper.New()}, + "tpcc_fk": {file: path.Join(s.benchmarkConfigPath, "tpcc_fk.yaml"), v: viper.New()}, } for configName, config := range s.benchmarkConfig { config.v.SetConfigFile(config.file) From cc465753f97b836d501f310cf7b8aba05981fc05 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 3 Jan 2024 14:25:42 -0500 Subject: [PATCH 3/5] Enhance tpcc_fk schema with FK enabled Signed-off-by: Florent Poinsard --- ansible/vitess-benchmark/tpcc_fk_vschema.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/vitess-benchmark/tpcc_fk_vschema.json b/ansible/vitess-benchmark/tpcc_fk_vschema.json index 73f4ef26b..05897f3f9 100644 --- a/ansible/vitess-benchmark/tpcc_fk_vschema.json +++ b/ansible/vitess-benchmark/tpcc_fk_vschema.json @@ -1,5 +1,6 @@ { "sharded": true, + "foreignKeyMode": "managed", "vindexes": { "hash": { "type": "hash" From 8a9b61ff1b2bded179db1325e07bed9651ccfbdd Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 3 Jan 2024 14:38:37 -0500 Subject: [PATCH 4/5] add minimum version to tpcc-fk Signed-off-by: Florent Poinsard --- config/benchmarks/tpcc_fk.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/benchmarks/tpcc_fk.yaml b/config/benchmarks/tpcc_fk.yaml index 0dfffdc68..ef831b718 100644 --- a/config/benchmarks/tpcc_fk.yaml +++ b/config/benchmarks/tpcc_fk.yaml @@ -1,6 +1,7 @@ ## Exec configuration exec-type: tpcc_fk exec-schema: "./vitess-benchmark/tpcc_fk_vschema.json" +minimum-version: 18 ## Ansible ansible-inventory-file: macrobench_sharded_inventory.yml From 4184a11fb67febf3a38e07b94dcc4bc04eee31b9 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 8 Jan 2024 16:40:30 -0500 Subject: [PATCH 5/5] use unsharded for tpcc_fk Signed-off-by: Florent Poinsard --- ansible/macrobench_sharded_inventory.yml | 2 - ansible/macrobench_unsharded_inventory.yml | 47 ++++++++-- ansible/vitess-benchmark/tpcc_fk_vschema.json | 92 +++---------------- config/benchmarks/tpcc_fk.yaml | 2 +- 4 files changed, 54 insertions(+), 89 deletions(-) diff --git a/ansible/macrobench_sharded_inventory.yml b/ansible/macrobench_sharded_inventory.yml index f29001d8c..f7be9f88c 100644 --- a/ansible/macrobench_sharded_inventory.yml +++ b/ansible/macrobench_sharded_inventory.yml @@ -19,8 +19,6 @@ all: vars: arewefastyet_git_repo: "https://github.com/vitessio/arewefastyet.git" arewefastyet_git_version: "main" - macrobenchmark_vschema_oltp: "./vitess-benchmark/sysbench.json" - macrobenchmark_vschema_tpcc: "./vitess-benchmark/tpcc_vschema.json" cell: local keyspace: main provision: 1 diff --git a/ansible/macrobench_unsharded_inventory.yml b/ansible/macrobench_unsharded_inventory.yml index 53ea1c1c1..a70bf2c6a 100644 --- a/ansible/macrobench_unsharded_inventory.yml +++ b/ansible/macrobench_unsharded_inventory.yml @@ -19,7 +19,6 @@ all: vars: arewefastyet_git_repo: "https://github.com/vitessio/arewefastyet.git" arewefastyet_git_version: "main" - macrobenchmark_vschema: "./vitess-benchmark/sysbench.json" cell: local keyspace: main provision: 1 @@ -28,7 +27,8 @@ all: hosts: DEVICE_IP_0: vars: - vtgate_web_ports: "15001,15002" + + vtgate_web_ports: "15001,15002,15003" sysbench: hosts: DEVICE_IP_0: @@ -43,7 +43,7 @@ all: DEVICE_IP_0: vtgate: vars: - vtgate_max_goproc: 6 + vtgate_max_goproc: 42 hosts: DEVICE_IP_0: gateways: @@ -55,10 +55,14 @@ all: port: 15002 mysql_port: 13307 grpc_port: 15307 + - id: 3 + port: 15003 + mysql_port: 13308 + grpc_port: 15308 vttablet: vars: - vitess_memory_ratio: 0.6 - vttablet_max_goproc: 24 + vitess_memory_ratio: 0.8 + vttablet_max_goproc: 42 hosts: DEVICE_IP_0: tablets: @@ -66,4 +70,35 @@ all: keyspace: main shard: 0 pool_size: 500 - transaction_cap: 2000 \ No newline at end of file + transaction_cap: 2000 + port: 16011 + grpc_port: 17011 + mysql_port: 18011 + mysqld_exporter_port: 9104 + - id: 1002 + keyspace: main + shard: 0 + pool_size: 500 + transaction_cap: 2000 + port: 16012 + grpc_port: 17012 + mysql_port: 18012 + mysqld_exporter_port: 9105 + - id: 2001 + keyspace: main + shard: 0 + pool_size: 500 + transaction_cap: 2000 + port: 16021 + grpc_port: 17021 + mysql_port: 18021 + mysqld_exporter_port: 9106 + - id: 2002 + keyspace: main + shard: 0 + pool_size: 500 + transaction_cap: 2000 + port: 16022 + grpc_port: 17022 + mysql_port: 18022 + mysqld_exporter_port: 9107 diff --git a/ansible/vitess-benchmark/tpcc_fk_vschema.json b/ansible/vitess-benchmark/tpcc_fk_vschema.json index 05897f3f9..aee404a6f 100644 --- a/ansible/vitess-benchmark/tpcc_fk_vschema.json +++ b/ansible/vitess-benchmark/tpcc_fk_vschema.json @@ -1,84 +1,16 @@ { - "sharded": true, - "foreignKeyMode": "managed", - "vindexes": { - "hash": { - "type": "hash" - } - }, - "tables": { - "customer1": { - "column_vindexes": [ - { - "column": "c_w_id", - "name": "hash" - } - ] - }, - "district1": { - "column_vindexes": [ - { - "column": "d_w_id", - "name": "hash" - } - ] - }, - "history1": { - "column_vindexes": [ - { - "column": "h_w_id", - "name": "hash" - } - ] - }, - "item1": { - "column_vindexes": [ - { - "column": "i_id", - "name": "hash" - } - ] - }, - "new_orders1": { - "column_vindexes": [ - { - "column": "no_w_id", - "name": "hash" - } - ] - }, - "order_line1": { - "column_vindexes": [ - { - "column": "ol_w_id", - "name": "hash" - } - ] - }, - "orders1": { - "column_vindexes": [ - { - "column": "o_w_id", - "name": "hash" - } - ] - }, - "stock1": { - "column_vindexes": [ - { - "column": "s_w_id", - "name": "hash" - } - ] - }, - "warehouse1": { - "column_vindexes": [ - { - "column": "w_id", - "name": "hash" - } - ] + "sharded": false, + "foreignKeyMode": "managed", + "tables": { + "customer1": {}, + "district1": {}, + "history1": {}, + "item1": {}, + "new_orders1": {}, + "order_line1": {}, + "orders1": {}, + "stock1": {}, + "warehouse1": {} } - } } diff --git a/config/benchmarks/tpcc_fk.yaml b/config/benchmarks/tpcc_fk.yaml index ef831b718..b7a1f23ee 100644 --- a/config/benchmarks/tpcc_fk.yaml +++ b/config/benchmarks/tpcc_fk.yaml @@ -4,7 +4,7 @@ exec-schema: "./vitess-benchmark/tpcc_fk_vschema.json" minimum-version: 18 ## Ansible -ansible-inventory-file: macrobench_sharded_inventory.yml +ansible-inventory-file: macrobench_unsharded_inventory.yml ansible-playbook-file: macrobench.yml ## Macrobench cmd