PS-11120 [8.4]: Reduce contention on BUF_BLOCK_MUTEX by reading ahead the access_time#6026
Open
polchawa-percona wants to merge 1 commit into
Open
PS-11120 [8.4]: Reduce contention on BUF_BLOCK_MUTEX by reading ahead the access_time#6026polchawa-percona wants to merge 1 commit into
polchawa-percona wants to merge 1 commit into
Conversation
Contributor
Author
|
Reproduction steps: Initialize a new data directory: Run via client: use my.cnf: Run test (a few times): |
satya-bodapati
approved these changes
Jun 23, 2026
satya-bodapati
left a comment
Contributor
There was a problem hiding this comment.
Please squash the commits before merge
8a474b1 to
2f07e97
Compare
…ccess_time This patch reduces contention inside buf_page_optimistic_get. We acquire there the BUF_BLOCK_MUTEX twice. But the second time we acquire only to update the access time. Given that we would update the access time only if it was zero, we could avoid acquiring the mutex when we knew that the access time was already non-zero. This we could learn the first time we acquired the mutex by reading the access time field of the page. Note: the second time we acquired the mutex, we re-check if it still was zero anyway, so the patch is safe and allows to save significant number of times we needed to acquire the mutex. This is a contribution from: Anna Glasgall (with a minor fix).
2f07e97 to
5da664b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/PS-11120
This patch reduces contention inside
buf_page_optimistic_get. We acquire the BUF_BLOCK_MUTEX twice there. But the second time we acquire it only to update the access time. Given that we would update the access time only if it was zero, we could avoid acquiring the mutex when we knew that the access time was already non-zero. This we could learn the first time we acquired the mutex by reading the access time field of the page.Note:
buf_block_buf_fix_inc), which is to keep the page alive (purpose of fixing) until it is "unfixed" (much later)The patch is safe and allows us to save a significant number of times we needed to acquire the mutex.
This is a contribution from: Anna Glasgall aglasgal@akamai.com / Akamai, with a minor fix added.