Skip to content

Feat/sysbench runner image - #67

Open
amh1k wants to merge 3 commits into
mainfrom
feat/sysbench-runner-image
Open

amh1k wants to merge 3 commits into
mainfrom
feat/sysbench-runner-image

Conversation

@amh1k

@amh1k amh1k commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #63
Add a standalone sysbench runner for MySQL with optional table preparation, secure credential handling, and structured TPS/latency metrics. Include a non-root Docker image, documentation, and CI coverage.

Backend and frontend integration follow separately.

Verification

  • Go vet and race tests passed.
  • All seven Docker smoke-test scenarios passed against MySQL 8.4.
  • README setup, run, and cleanup commands verified locally.

amh1k added 3 commits October 21, 2026 13:29
Signed-off-by: amh1k <abdulmoizx97@gmail.com>
Signed-off-by: amh1k <abdulmoizx97@gmail.com>
Verify execution against disposable MySQL, preserve preparation failure exit status, and document configuration and local usage.

Signed-off-by: amh1k <abdulmoizx97@gmail.com>
@amh1k
amh1k requested a review from spron-in October 22, 2026 15:37

@spron-in spron-in left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, it's a solid runner! It follows the pgbench runner contract closely, and I checked the config-file encoding against sysbench 1.0.20's read_config parser in sb_options.c: the quote selection, the rejected characters, and the 254-byte line limit all match. The MySQL smoke script is thorough too (the FLUSH PRIVILEGES full-auth check and the preserved-row check are nice touches).

I left one main point on the round-trip test plus a few optional nits inline.

Question on scope: the runner doesn't expose TLS settings yet (e.g. --mysql-ssl, --mysql-ssl-ca, and friends) or a connect timeout, so clusters that require secure transport will fail to connect. The pgbench runner passes PGSSLMODE and PGCONNECT_TIMEOUT through. Are you planning to add TLS support (and ideally a connect timeout) in a follow-up PR? I'm fine with that not blocking this one.

Minor: the README is quite long (≈270 lines). The local example and cleanup sections could probably be trimmed, but that's optional.

func TestConnectionConfigRoundTripsThroughSysbench(t *testing.T) {
executable, err := exec.LookPath("sysbench")
if err != nil {
t.Skip("sysbench is not installed; run this check with the image's toolchain")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only test that sends the encoding through sysbench's real parser, and that encoding is the riskiest logic in the PR. But sysbench isn't installed on the CI runner, so the test always skips there, and per the README it has only been run by hand inside the image.

Could the Sysbench Runner job run it inside the built image? For example, after docker build:

cd runners/sysbench
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test -c -o /tmp/sysbench-runner.test .
docker run --rm --entrypoint /tmp/sysbench-runner.test \
  -v /tmp/sysbench-runner.test:/tmp/sysbench-runner.test:ro \
  plugin-bench-sysbench:ci -test.run '^TestConnectionConfigRoundTripsThroughSysbench$' -test.v \
  | tee /tmp/roundtrip.log
! grep -q -- '--- SKIP' /tmp/roundtrip.log

The final grep makes the job fail if the test silently skips (for example, if the binary is missing from PATH).

value = `"` + value + `"`
case strings.ContainsRune(value, ',') || strings.ContainsFunc(value, unicode.IsSpace) || strings.ContainsAny(value[:1], "'\"#"):
return nil, fmt.Errorf("%s cannot be represented in the sysbench configuration file", field.setting)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: values containing both quote types are written unquoted only because none of the cases match. An explicit default would make that path easier to see:

Suggested change
}
default:
// Both quote types present: sysbench reads the value unquoted.
}

# package includes the Lua workloads and pulls in the MySQL client library.
RUN set -eu; \
apt-get update; \
apt-get install -y --no-install-recommends sysbench=1.0.20+ds-5; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pinning the exact Debian package revision means the build breaks as soon as bookworm (now oldstable) ships an updated sysbench package, because apt won't find 1.0.20+ds-5 anymore. The build-time grep -Eq '^sysbench 1\.0\.20$' already guards the version that matters. For reproducible builds, consider pinning the base image by digest instead (FROM debian:bookworm-slim@sha256:...) and dropping the +ds-5 revision, or pinning to sysbench=1.0.20*.

Comment thread runners/sysbench/go.mod
@@ -0,0 +1,3 @@
module github.com/openeverest/plugin-bench/runners/sysbench

go 1.25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: nothing in the runner seems to need Go 1.25 (the newest feature I spotted is the min builtin from 1.21), while runners/pgbench targets go 1.22. Consider aligning the two runners, either lowering this to 1.22 or bumping both together, so the CI matrix stays consistent.

umask 077
config=$(mktemp /tmp/sysbench-cleanup.XXXXXX)
trap '\''rm -f "$config"'\'' EXIT
printf "mysql-host=%s\nmysql-port=%s\nmysql-db=%s\nmysql-user=%s\nmysql-password=%s\n" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this writes the password unquoted, so it only works for simple values. The text says so, but the snippet is easy to copy. Quoting the values keeps it closer to what the wrapper does and handles spaces, #, and commas:

Suggested change
printf "mysql-host=%s\nmysql-port=%s\nmysql-db=%s\nmysql-user=%s\nmysql-password=%s\n" \
printf "mysql-host='%s'\nmysql-port=%s\nmysql-db='%s'\nmysql-user='%s'\nmysql-password='%s'\n" \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a sysbench runner image for MySQL benchmarks

2 participants