Skip to content

Commit

Permalink
/go/performance/continuous_integration: update dockerfile to install …
Browse files Browse the repository at this point in the history
…postgres and doltgres for testing the benchmark runner
  • Loading branch information
coffeegoddd committed Feb 14, 2024
1 parent 27f37ad commit 7c476ef
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 106 deletions.
45 changes: 39 additions & 6 deletions go/performance/continuous_integration/SysbenchDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ RUN \
# Smoke test
&& sqlite3 --version


WORKDIR /
COPY ./go /dolt/go
COPY ./config.json /config.json
COPY ./tpcc-config.json /tpcc-config.json
# COPY ./go /dolt/go
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
Expand All @@ -62,9 +68,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"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
**

# Except for the following
!mysqld.cnf
!go
!config.json
!tpcc-config.json
!sysbench-runner-tests-entrypoint.sh
41 changes: 0 additions & 41 deletions go/performance/continuous_integration/config.json

This file was deleted.

78 changes: 78 additions & 0 deletions go/performance/continuous_integration/mysqld.cnf
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
23 changes: 0 additions & 23 deletions go/performance/continuous_integration/tpcc-config.json

This file was deleted.

60 changes: 31 additions & 29 deletions go/performance/utils/benchmark_runner/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7c476ef

Please sign in to comment.