Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contrib Fake PR: Testing Patch for Bug#115988 - Too Much Disk Read on Startup, penalizing deployments with many tables (1M+) #14

Draft
wants to merge 1 commit into
base: mysql-9.0.1_for_fake_prs
Choose a base branch
from

Conversation

jfg956
Copy link
Owner

@jfg956 jfg956 commented Sep 3, 2024

This PR contains a testing patch for reducing the amount of data read from disk during MySQL startup. When enabling the testing flags (innodb_tablespace_startup_testing_fadvise and innodb_tablespace_startup_testing_light, disabled by default), the amount of data read per table on startup is divided by 8 (32 kb to 4 kb), which reduces MySQL startup time from 2:39 to 1:09 (1 minute 9 seconds).

This is a "Contrib Fake PR". It is there so people can comment on this work in case it needs adjustments. This has be contributed on 2024-09-03 as a patch file in Bug#115988. More about this in a previous RFC blog post, section Fake PRs and my Way of Working on MySQL Contributions.

This PR merges on 9.0.1, and the corresponding patch file applies to 8.4.2 and 8.0.39. Because this PR significantly improves MySQL startup, I think it should be back ported to 8.0 and 8.4, and if it is considered a "breaking change", with feature flags / global variables to enable the optimizations, disabled by default.

The analysis of the problems addressed by this PR can be found in Bug#115988: Too Much Disk Read on Startup, penalizing deployments with many tables (1M+).

This PR introduces two testing flags / global variables, disabled by default: innodb_tablespace_startup_testing_fadvise and innodb_tablespace_startup_testing_light. They allow enabling the optimizations introduced by this PR. When merging in 9.0, I assumed it did not make sense to keep these, hence "testing" naming and limited documentation. If it is decided they are needed, they should be renamed and documented adequately, which I can do if asked by Oracle.

While doing this work, I "played with fire" and refactored a few things. They are identified as "I / JFG had a visceral reaction ..." as comments in the code. These and other comments are in the code for the clarity of the PR, they should be removed / adjusted when merging.

And one last thing: the "light" optimization will probably not work on filesystems that have a 16-kilobyte block size (like a deployment on zfs). This means that when avoiding the overhead of the double write buffer, one will have to pay an overhead on startup. As usual, every optimization has a tradeoff ¯_(ツ)_/¯.

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.

1 participant