From c0e9d077b9ca8df34a818a1930e245e7fe892d00 Mon Sep 17 00:00:00 2001 From: coffeegoddd Date: Wed, 14 Feb 2024 15:38:59 -0800 Subject: [PATCH] /go/performance/continuous_integration: update dockerfile to install postgres and doltgres for testing the benchmark runner --- .../continuous_integration/SysbenchDockerfile | 44 +++++++++-- .../SysbenchDockerfile.dockerignore | 3 +- .../continuous_integration/config.json | 41 ---------- .../continuous_integration/mysqld.cnf | 78 +++++++++++++++++++ .../sysbench-runner-tests-entrypoint.sh | 7 +- .../continuous_integration/tpcc-config.json | 23 ------ .../utils/benchmark_runner/run_test.go | 60 +++++++------- 7 files changed, 150 insertions(+), 106 deletions(-) delete mode 100644 go/performance/continuous_integration/config.json create mode 100644 go/performance/continuous_integration/mysqld.cnf delete mode 100644 go/performance/continuous_integration/tpcc-config.json diff --git a/go/performance/continuous_integration/SysbenchDockerfile b/go/performance/continuous_integration/SysbenchDockerfile index c6edaf1d41..195114eb35 100644 --- a/go/performance/continuous_integration/SysbenchDockerfile +++ b/go/performance/continuous_integration/SysbenchDockerfile @@ -41,14 +41,19 @@ RUN \ # Smoke test && sqlite3 --version + WORKDIR / -COPY ./go /dolt/go -COPY ./config.json /config.json -COPY ./tpcc-config.json /tpcc-config.json COPY ./sysbench-runner-tests-entrypoint.sh /entrypoint.sh RUN git clone https://github.com/dolthub/sysbench-lua-scripts.git RUN git clone https://github.com/Percona-Lab/sysbench-tpcc.git +# install doltgres +ENV DOLTGRESQL_VERSION=${DOLTGRESQL_VERSION:-v0.4.0} +RUN git clone https://github.com/dolthub/doltgresql.git +RUN cd doltgresql/utils/doltgres_builder/cmd && go run . "$DOLTGRESQL_VERSION" +ENV PATH="/doltgresql/utils/doltgres_builder/cmd/doltgresBin/$DOLTGRESQL_VERSION:${PATH}" +RUN doltgres version + WORKDIR /mysql RUN curl -L -O https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb RUN dpkg -i mysql-apt-config_0.8.22-1_all.deb @@ -62,9 +67,36 @@ RUN sed -i.bak \ RUN apt-get update && apt-get install -y --allow-unauthenticated mysql-server RUN mysql --version -# Install dolt -WORKDIR /dolt/go/cmd/dolt +# Install Postgres 15 +WORKDIR /postgres +RUN sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +# currently this command fails, but it succeeds on the the stuff we need +RUN apt-get update -y || true +# currently this command fails, but it succeeds on the the stuff we need +RUN apt-get -y install postgresql-15 || true + +ENV PATH="/usr/lib/postgresql/15/bin:${PATH}" + +RUN postgres --version + +# create new user and add to postgres group so postgres can be run +ARG UNAME=tester +RUN useradd -m -u 199 $UNAME +RUN usermod -aG postgres tester +COPY ./mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf + +# install dolt +COPY ./go /home/tester/dolt/go +WORKDIR /home/tester/dolt/go/cmd/dolt RUN go build -o /usr/local/bin/dolt . +RUN go mod tidy +RUN chown -R tester:tester /go +USER $UNAME + +# create directories owned by new user for mysql as well +RUN mkdir -p /home/tester/.mysql/log +WORKDIR /home/tester -WORKDIR /dolt/go/performance/utils/sysbench_runner/cmd +WORKDIR /home/tester/dolt/go/performance/utils/benchmark_runner ENTRYPOINT ["/entrypoint.sh"] diff --git a/go/performance/continuous_integration/SysbenchDockerfile.dockerignore b/go/performance/continuous_integration/SysbenchDockerfile.dockerignore index 4cf2039891..93d4b5bf04 100644 --- a/go/performance/continuous_integration/SysbenchDockerfile.dockerignore +++ b/go/performance/continuous_integration/SysbenchDockerfile.dockerignore @@ -2,7 +2,6 @@ ** # Except for the following +!mysqld.cnf !go -!config.json -!tpcc-config.json !sysbench-runner-tests-entrypoint.sh diff --git a/go/performance/continuous_integration/config.json b/go/performance/continuous_integration/config.json deleted file mode 100644 index dbca4e35d5..0000000000 --- a/go/performance/continuous_integration/config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Runs": 1, - "Servers": [ - { - "Host": "0.0.0.0", - "Port": 4433, - "Server": "dolt", - "Version": "HEAD", - "ResultsFormat": "csv", - "ServerExec": "/usr/local/bin/dolt" - }, - { - "Server": "mysql", - "Version": "8.0.22", - "ResultsFormat": "csv", - "ServerExec": "/usr/sbin/mysqld", - "ConnectionProtocol": "unix", - "ServerUser": "root", - "SkipLogBin": true - } - ], - "ScriptDir":"/sysbench-lua-scripts", - "Tests": [ - { - "Name":"covering_index_scan", - "N" : 1, - "FromScript": true - }, - { - "Name":"index_join", - "N" : 1, - "FromScript": true - }, - { - "Name":"groupby_scan", - "N" : 1, - "FromScript": true - }], - "TestOptions": ["--rand-seed=1", "--table-size=30"], - "InitBigRepo": true -} diff --git a/go/performance/continuous_integration/mysqld.cnf b/go/performance/continuous_integration/mysqld.cnf new file mode 100644 index 0000000000..7fe5d9c40f --- /dev/null +++ b/go/performance/continuous_integration/mysqld.cnf @@ -0,0 +1,78 @@ +# +# The MySQL database server configuration file. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +[mysqld] +# +# * Basic Settings +# +user = tester +pid-file = /home/tester/.mysql/mysqld.pid +socket = /home/tester/.mysql/mysqld.sock +# port = 3306 +# datadir = /var/lib/mysql + + +# If MySQL is running as a replication slave, this should be +# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir +# tmpdir = /tmp +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +bind-address = 127.0.0.1 +mysqlx-bind-address = 127.0.0.1 +# +# * Fine Tuning +# +key_buffer_size = 16M +# max_allowed_packet = 64M +# thread_stack = 256K + +# thread_cache_size = -1 + +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover-options = BACKUP + +# max_connections = 151 + +# table_open_cache = 4000 + +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# +# Log all queries +# Be aware that this log type is a performance killer. +general_log_file = /home/tester/.mysql/log/query.log +# general_log = 1 +# +# Error log - should be very few entries. +# +log_error = /home/tester/.mysql/log/error.log +# +# Here you can see queries with especially long duration +# slow_query_log = 1 +slow_query_log_file = /home/tester/.mysql/log/mysql-slow.log +# long_query_time = 2 +# log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +# server-id = 1 +log_bin = /home/tester/.mysql/log/mysql-bin.log +# binlog_expire_logs_seconds = 2592000 +max_binlog_size = 100M +# binlog_do_db = include_database_name +# binlog_ignore_db = include_database_name diff --git a/go/performance/continuous_integration/sysbench-runner-tests-entrypoint.sh b/go/performance/continuous_integration/sysbench-runner-tests-entrypoint.sh index 7b6ad3b9dc..9d9d249cf2 100755 --- a/go/performance/continuous_integration/sysbench-runner-tests-entrypoint.sh +++ b/go/performance/continuous_integration/sysbench-runner-tests-entrypoint.sh @@ -5,8 +5,5 @@ set -o pipefail dolt version # Github Actions ignores the WORKDIR? -cd ./go/performance/utils/sysbench_runner/cmd -DEBUG=1 go run . --config=/config.json - -cd /dolt/go/performance/utils/tpcc_runner/cmd -DEBUG=1 go run . --config=/tpcc-config.json +cd ./go/performance/utils/benchmark_runner +DEBUG=true RUN_BENCHMARK_RUNNER_TESTS=true go test ./... diff --git a/go/performance/continuous_integration/tpcc-config.json b/go/performance/continuous_integration/tpcc-config.json deleted file mode 100644 index bdfda39cc3..0000000000 --- a/go/performance/continuous_integration/tpcc-config.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "Servers": [ - { - "Host": "0.0.0.0", - "Port": 4433, - "Server": "dolt", - "Version": "HEAD", - "ResultsFormat": "csv", - "ServerExec": "/usr/local/bin/dolt" - }, - { - "Server": "mysql", - "Version": "8.0.22", - "ResultsFormat": "csv", - "ServerExec": "/usr/sbin/mysqld", - "ConnectionProtocol": "unix", - "ServerUser": "root", - "SkipLogBin": true - } - ], - "ScriptDir":"/sysbench-tpcc", - "ScaleFactors": [1] -} diff --git a/go/performance/utils/benchmark_runner/run_test.go b/go/performance/utils/benchmark_runner/run_test.go index f97d261e67..7202cb57ac 100644 --- a/go/performance/utils/benchmark_runner/run_test.go +++ b/go/performance/utils/benchmark_runner/run_test.go @@ -38,22 +38,26 @@ func TestRunner(t *testing.T) { } conf := &sysbenchRunnerConfigImpl{ - Tests: selectTests("oltp_read_write", "oltp_update_index", "oltp_delete_insert"), + Tests: []TestConfig{ + NewTestConfig("oltp_read_write", nil, false), + NewTestConfig("oltp_update_index", nil, false), + NewTestConfig("oltp_delete_insert", nil, true), + }, //Tests: selectTests("oltp_read_write", "oltp_update_index", "oltp_update_non_index", "oltp_insert", "bulk_insert", "oltp_write_only", "oltp_delete"), Servers: []ServerConfig{ &doltServerConfigImpl{ Id: "test", - Version: "0.39.2", + Version: "HEAD", ResultsFormat: CsvFormat, - ServerExec: "/Users/max-hoffman/go/bin/dolt", + ServerExec: "/usr/local/bin/dolt", }, }, - ScriptDir: "/Users/max-hoffman/Documents/dolthub/sysbench-lua-scripts", + ScriptDir: "/sysbench-lua-scripts", TestOptions: []string{ "--rand-seed=1", - "--table-size=10000", + "--table-size=30", "--rand-type=uniform", - "--time=120", + "--time=30", "--percentile=50", }, InitBigRepo: true, @@ -93,28 +97,27 @@ func TestDoltMysqlSysbenchRunner(t *testing.T) { Servers: []ServerConfig{ &doltServerConfigImpl{ Id: "test-dolt", - Version: "1.33.0", + Version: "HEAD", ResultsFormat: CsvFormat, - ServerExec: "/Users/dustin/go/bin/dolt", + ServerExec: "/usr/local/bin/dolt", }, &mysqlServerConfigImpl{ Id: "test-mysql", - Host: "127.0.0.1", Port: 3606, Version: "8.0.35", ResultsFormat: CsvFormat, - ServerExec: "/opt/homebrew/bin/mysqld", + ServerExec: "/usr/sbin/mysqld", ServerUser: "root", SkipLogBin: true, - ConnectionProtocol: "tcp", + ConnectionProtocol: "unix", }, }, - ScriptDir: "/Users/dustin/src/sysbench-lua-scripts", + ScriptDir: "/sysbench-lua-scripts", TestOptions: []string{ "--rand-seed=1", - "--table-size=10000", + "--table-size=30", "--rand-type=uniform", - "--time=120", + "--time=30", "--percentile=50", }, InitBigRepo: true, @@ -148,8 +151,8 @@ func TestDoltgresPostgresSysbenchRunner(t *testing.T) { Host: "127.0.0.1", Version: "15.5", ResultsFormat: CsvFormat, - ServerExec: "/opt/homebrew/opt/postgresql@15/bin/postgres", - InitExec: "/opt/homebrew/opt/postgresql@15/bin/initdb", + ServerExec: "/usr/lib/postgresql/15/bin/postgres", + InitExec: "/usr/lib/postgresql/15/bin/initdb", ServerUser: "root", }, &doltgresServerConfigImpl{ @@ -158,15 +161,15 @@ func TestDoltgresPostgresSysbenchRunner(t *testing.T) { Host: "127.0.0.1", Version: "b139dfb", ResultsFormat: CsvFormat, - ServerExec: "/Users/dustin/go/bin/doltgres", + ServerExec: "doltgres", }, }, - ScriptDir: "/Users/dustin/src/sysbench-lua-scripts", + ScriptDir: "/sysbench-lua-scripts", TestOptions: []string{ "--rand-seed=1", - "--table-size=10000", + "--table-size=30", "--rand-type=uniform", - "--time=120", + "--time=30", "--percentile=50", }, InitBigRepo: true, @@ -197,16 +200,16 @@ func TestDoltProfiler(t *testing.T) { Servers: []ServerConfig{ &doltServerConfigImpl{ Id: id, - Version: "1.33.0", + Version: "HEAD", ResultsFormat: CsvFormat, - ServerExec: "/Users/dustin/go/bin/dolt", + ServerExec: "/usr/local/bin/dolt", ServerProfile: CpuServerProfile, ProfilePath: dir, }, }, TestOptions: []string{ "--rand-seed=1", - "--table-size=10000", + "--table-size=30", "--rand-type=uniform", "--time=30", "--percentile=50", @@ -239,23 +242,22 @@ func TestDoltMysqlTpccRunner(t *testing.T) { Servers: []ServerConfig{ &doltServerConfigImpl{ Id: "test-dolt-tpcc", - Version: "1.33.0", + Version: "HEAD", ResultsFormat: CsvFormat, - ServerExec: "/Users/dustin/go/bin/dolt", + ServerExec: "/usr/local/bin/dolt", }, &mysqlServerConfigImpl{ Id: "test-mysql-tpcc", - Host: "127.0.0.1", Port: 3606, Version: "8.0.35", ResultsFormat: CsvFormat, - ServerExec: "/opt/homebrew/bin/mysqld", + ServerExec: "/usr/sbin/mysqld", ServerUser: "root", SkipLogBin: true, - ConnectionProtocol: "tcp", + ConnectionProtocol: "unix", }, }, - ScriptDir: "/Users/dustin/src/sysbench-tpcc", + ScriptDir: "/sysbench-tpcc", } err = RunTpcc(context.Background(), conf)