perf(dev-env): tune local database performance defaults - #2874
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
fdf9ff7 to
14cf32f
Compare
| command: docker-entrypoint.sh mysqld --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION --max_allowed_packet=67M --mysql-native-password=ON | ||
| command: docker-entrypoint.sh mysqld --sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION --max_allowed_packet=67M --mysql-native-password=ON --skip-log-bin --innodb-buffer-pool-size=1G --innodb-redo-log-capacity=1G --innodb-flush-log-at-trx-commit=2 |
There was a problem hiding this comment.
Is this change friendly to existing environments? That is, if I create a dev env with an old VIP CLI, then run this VIP CLI and restart the environment, will it start?
There was a problem hiding this comment.
Good question. Something I did not test, and I'll run some tests and validate
There was a problem hiding this comment.
Alright. This validated fine and found no issues with existing environments.
I created a new environment on trunk (old 2.3.3 dev-env defaults), created an example post, switched to this branch and restarted the environment. It auto-updated to 2.3.4 and rebuilt, the site loaded fine with no database connection errors, the post survived, and the new flags were verified live in the container.
I also added an e2e test (014-database-defaults.spec.js).
|
|
This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed. This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved. |
Disable binary logging (MySQL), raise the buffer pool to 1G (matching the VIP production default), raise redo log capacity, and relax per-commit flushing. These are server-wide settings that benefit all local database use; the largest gains are on bulk SQL imports. Bump DEV_ENVIRONMENT_VERSION so existing environments pick up the new flags on next start. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Asserts the running database is not on stock defaults (floors, not pinned values, so future tuning does not break the test) and that an environment stamped with the previous version auto-updates on start, applies the new flags over its existing data directory, and keeps data. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
678e4b9 to
b6c771d
Compare
|
There was a problem hiding this comment.
Pull request overview
This PR tunes the local dev-env MySQL/MariaDB container startup flags to make bulk SQL imports (and everyday large-site queries) dramatically faster, at the cost of durability guarantees that are meaningless for a disposable local database. It is one of four companion dev-env import PRs (#2871–#2874). The DEV_ENVIRONMENT_VERSION bump ensures existing environments re-render the template and rebuild automatically on their next vip dev-env start, so no manual dev-env update is required.
Changes:
- Add InnoDB tuning flags to both DB branches of
dev-env.lando.template.yml.ejs: MySQL gets--skip-log-bin, 1G buffer pool, 1G redo-log-capacity, andflush-log-at-trx-commit=2; MariaDB gets the equivalents (1G buffer pool, 1Glog-file-size,flush=2), with binary logging already off by default. - Bump
DEV_ENVIRONMENT_VERSIONfrom2.3.3to2.3.4to force auto re-render/rebuild of existing environments. - Add e2e spec
014-database-defaults.spec.jscovering fresh non-stock defaults plus MySQL and MariaDB 10.3 upgrade-in-place paths (data survival + tuned values), using floor assertions rather than pinned sizes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
assets/dev-env.lando.template.yml.ejs |
Adds documented InnoDB performance flags to the MySQL and MariaDB mysqld command lines. |
src/lib/constants/dev-environment.ts |
Bumps DEV_ENVIRONMENT_VERSION so existing environments auto-rebuild with the new template. |
__tests__/devenv-e2e/014-database-defaults.spec.js |
New e2e coverage for fresh defaults and upgrade-in-place (MySQL + MariaDB) with data-survival checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.



Problem
The dev-env database containers run with stock settings that are hostile to bulk imports:
SET SESSION SQL_LOG_BIN = 0opt-out fails (thewordpressuser lacksSYSTEM_VARIABLES_ADMIN), so this always happens.Redo log writer is waiting for a new redo log file/log_checkpointer still lagging behindwarnings.innodb_flush_log_at_trx_commit=1): durability guarantees that are meaningless for a disposable local database, paid for on every one of myloader's transactions.Fix
assets/dev-env.lando.template.yml.ejs, both database branches. Note these are server-widemysqldstartup flags — they benefit all local database use (the buffer pool in particularhelps everyday WordPress queries on large sites), with the most dramatic gains on bulk imports:
--skip-log-bin--innodb-buffer-pool-size=1G--innodb-redo-log-capacity=1G--innodb-log-file-size=1G--innodb-flush-log-at-trx-commit=2DEV_ENVIRONMENT_VERSIONis bumped2.3.3→2.3.4(src/lib/constants/dev-environment.ts) so existing environments re-render the template and rebuild automatically on their nextvip dev-env start— no manualdev-env updateneeded.Testing
.lando.ymland live values after the auto-update path (maybeUpdateVersion()→updateEnvironment()→ lando rebuild):log_bin=0, pool 1G, redo 1G,flush=2__tests__/devenv-e2e/014-database-defaults.spec.jscovers both scenarios permanently: (1) a fresh environment runs with non-stock database defaults, and (2) an environment stamped with the previous version auto-updates onstart, applies the new defaults to its existing data directory, and keeps its data. Assertions use floors (e.g. pool > stock 128M) rather than pinned values, so future tuning of the sizes does not break the test — only losing an override doesTrade-off note
innodb_flush_log_at_trx_commit=2means up to ~1s of writes can be lost if the host crashes (not just mysqld). For a local dev database that is recreated from imports, this is the intended trade.Changelog Description
Changed
Related
-ofix), fix(dev-env): recompute mydumper section sizes after search-replace #2872 (search-replace size fix), fix(validations): avoid ENGINE != InnoDB false positives on row data #2873 (ENGINE validation)🤖 Generated with Claude Code