Skip to content

Commit d348249

Browse files
committed
docker: allow tmpfs on Mac/Windows; use smaller redo logs
This commit makes two performance improvements affecting workspace=docker, as well as Skeema's integration test suites: * Previously, when using docker-cleanup=destroy, the container would use a tmpfs mount automatically only on a native Linux host. This was due to a common misinterpretation of the Docker docs; tmpfs actually is also usable on Docker Desktop for MacOS or Windows. This is now fixed, and likewise for a few integration tests which can now leverage tmpfs on any host OS. * InnoDB redo logs for new containers are now set to their minimum allowed value of 4mb. Ordinarily, this could be problematic on MySQL 8+ even for a DDL-only workload on throwaway ephemeral container, because DDL in MySQL 8+ writes to the InnoDB-based data dictionary. However, this is now doable because the previous commit ca85df7 disables redo logging in MySQL 8+ for Skeema's workspace containers and integration test containers. Meanwhile, MySQL 5.x and MariaDB (any version) use frm files, so Skeema's DDL workload won't be constrained by a tiny redo log. The second change is primarily included here because it reduces memory usage when operating on tmpfs from the first change.
1 parent ca85df7 commit d348249

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

internal/applier/applier_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ func (s *ApplierIntegrationSuite) Setup(backend string) error {
185185
Image: backend,
186186
RootPassword: "fakepw",
187187
DataTmpfs: (n > 0), // we destroy the 2nd container after this test in Teardown anyway
188-
189188
})
190189
return err
191190
})

internal/tengo/docker.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"log"
99
"os"
1010
"os/exec"
11-
"runtime"
1211
"strconv"
1312
"strings"
1413
"time"
@@ -82,7 +81,7 @@ type DockerizedInstanceOptions struct {
8281

8382
// Options that only affect new container creation:
8483
DataBindMount string // Host path to bind-mount as /var/lib/mysql in container
85-
DataTmpfs bool // Use tmpfs for /var/lib/mysql. Only used if no DataBindMount, runtime.GOOS is Linux, and image is from a top-level repo (e.g. "foo" but not "foo/bar")
84+
DataTmpfs bool // Use tmpfs for /var/lib/mysql. Only used if no DataBindMount, and image is from a top-level repo (e.g. "foo" but not "foo/bar")
8685
EnableBinlog bool // Enable or disable binary log in database server
8786
LowerCaseTableNames uint8 // lower_case_table_names setting (0, 1, or 2) in database server
8887
}
@@ -123,9 +122,8 @@ func CreateDockerizedInstance(opts DockerizedInstanceOptions) (*DockerizedInstan
123122
}
124123
if opts.DataBindMount != "" {
125124
dflags = append(dflags, "-v {DATABINDMOUNT}")
126-
} else if opts.DataTmpfs && runtime.GOOS == "linux" && !strings.ContainsRune(opts.Image, '/') {
127-
// tmpfs can only be used on *native* Linux (not Docker Desktop for Mac/Win).
128-
// It can also cause permission issues with some non-Docker-official images,
125+
} else if opts.DataTmpfs && !strings.ContainsRune(opts.Image, '/') {
126+
// tmpfs can cause permission issues with some non-Docker-official images,
129127
// such as percona/percona-server; for this reason we only enable it for
130128
// images from the top-level namespace, since these are known to support it.
131129
dflags = append(dflags, "--tmpfs /var/lib/mysql")
@@ -136,7 +134,7 @@ func CreateDockerizedInstance(opts DockerizedInstanceOptions) (*DockerizedInstan
136134
// instances used only for schema management, we can configure the server in a
137135
// way that reduces resource usage and improves performance for this workload
138136
serverArgs := []string{
139-
"--innodb-log-file-size=16777216", // use smaller 16MB redo log files, instead of default of 48MB-96MB (varies by flavor)
137+
"--innodb-log-file-size=4194304", // use smaller 4MB redo log files, instead of default of 48MB-96MB (varies by flavor)
140138
"--innodb-buffer-pool-size=33554432", // use smaller 32MB buffer pool, instead of default of 128MB
141139
"--performance-schema=0", // disable performance_schema to reduce memory usage and other overhead
142140
"--skip-innodb-adaptive-hash-index", // AHI not beneficial to DDL-based workload

0 commit comments

Comments
 (0)