From 1827a912780a2c567cfbe66befe249df44193935 Mon Sep 17 00:00:00 2001 From: mlsmaycon Date: Sat, 12 Sep 2026 12:00:37 +0000 Subject: [PATCH] [management] Skip durability work in the MySQL test container Cloning the schema from a template cut the per-test store cost on Postgres from about 0.9s to 0.3s but barely moved MySQL, which stayed at 1.5s to 1.9s per store. The time is the DDL itself: with the server defaults each CREATE TABLE fsyncs the redo log, the binary log and the doublewrite buffer, and the suite issues about 40 of them per test. Start mysqld in the test container without the binary log, without the doublewrite buffer and without a redo fsync per commit. The image is the official MySQL entrypoint, so the flags are passed as the container command. Tables stay in per-table files: with innodb_file_per_table off the packages that create hundreds of databases per run got slower, not faster, because dropped databases leave the shared system tablespace to grow and fragment. Measured on healthy runners, management/server on MySQL went from 10m16s to 6m36s and the store package from 4m20s to 2m41s, with per-test store setup down from about 1.6s to about 0.5s. --- management/server/testutil/store.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/management/server/testutil/store.go b/management/server/testutil/store.go index 07699e2c3..3854c1173 100644 --- a/management/server/testutil/store.go +++ b/management/server/testutil/store.go @@ -37,6 +37,18 @@ func CreateMysqlTestContainer() (func(), string, error) { mysql.WithDatabase("testing"), mysql.WithUsername("root"), mysql.WithPassword("testing"), + // Every test creates and drops a database with about 40 tables, so with + // the server defaults the run is dominated by durability work: each + // CREATE TABLE fsyncs the redo log, the binary log and the doublewrite + // buffer. None of it protects anything in a container that is discarded + // after the run. Tables stay in per-table files on purpose: in the shared + // system tablespace the cost of every CREATE and DROP grew with the number + // of databases the run had already created. + testcontainers.WithCmd("mysqld", + "--innodb-flush-log-at-trx-commit=0", + "--innodb-doublewrite=OFF", + "--skip-log-bin", + ), testcontainers.WithWaitStrategy( wait.ForLog("/usr/sbin/mysqld: ready for connections"). WithOccurrence(1).WithStartupTimeout(15*time.Second).WithPollInterval(100*time.Millisecond),