Skip to content

PS-11120 [trunk]: Reduce contention on BUF_BLOCK_MUTEX by reading ahead the access_time#6044

Open
polchawa-percona wants to merge 1 commit into
percona:trunkfrom
polchawa-percona:PS-11120-trunk
Open

PS-11120 [trunk]: Reduce contention on BUF_BLOCK_MUTEX by reading ahead the access_time#6044
polchawa-percona wants to merge 1 commit into
percona:trunkfrom
polchawa-percona:PS-11120-trunk

Conversation

@polchawa-percona

Copy link
Copy Markdown
Contributor

https://perconadev.atlassian.net/browse/PS-11120

trunk equivalent of #6031.

This patch reduces contention inside buf_page_optimistic_get. We acquire the BUF_BLOCK_MUTEX twice there, but the second time only to update the access time — and only if it was zero. By reading the access time the first time we hold the mutex, we can avoid re-acquiring it when the page has already been accessed (non-zero access time), which is the common case for hot pages.

Why it is safe:

  • the second time the mutex is taken, the access time is re-checked anyway;
  • access time is never reset to zero (except when a page is reinitialized);
  • the page cannot be reinitialized meanwhile, because it was buffer-fixed (buf_block_buf_fix_inc) on first access and stays alive until unfixed.

This is a contribution from Anna Glasgall aglasgal@akamai.com / Akamai, with a minor fix added.

…ad the access_time

https://perconadev.atlassian.net/browse/PS-11120

This patch reduces contention inside buf_page_optimistic_get. We acquire the
BUF_BLOCK_MUTEX twice there. The second time we acquire it only to update the
access time, and only if it was zero. By reading the access time the first
time we hold the mutex, we can skip re-acquiring it when the page has already
been accessed (non-zero access time), which is the common case for hot pages.

This is safe because: the second time the mutex is taken the access time is
re-checked anyway; access time is never reset to zero (except when a page is
reinitialized); and the page cannot be reinitialized meanwhile because it was
buffer-fixed on first access.

This is a contribution from Anna Glasgall <aglasgal@akamai.com> / Akamai, with
a minor fix added.
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