Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32175

page_align() or page_offset() may cost some performance

Details

    Description

      In MDEV-29445, I wanted to remove the data member buf_page_t::frame, because there is a simple 1:1 mapping between page frame addresses and block descriptor addresses. That is, the data member would be replaced with a member function buf_page_t::frame(). Because I anticipated the member function calls to cause some performance regression, I thought that it would make sense to remove as many references to buf_page_t::frame as possible.

      I just tested this change on top of the latest 10.6. In my quick test (Sysbench oltp_write_only), the performance difference is at most 2%, sometimes showing a regression, sometimes an improvement.

      I think that it would be useful to run more tests and refine this patch, to revert parts that are not helpful (causing extra calls to page_align() or page_offset()). The outcome of this might be that it is better to retain the redundant data member buf_page_t::frame in MDEV-29445.

      Attachments

        Issue Links

          Activity

            checked the generated code size and started working on additional changes

            marko Marko Mäkelä added a comment - checked the generated code size and started working on additional changes

            I took another approach, initially defining the functions page_align() and page_offsets() non-inline, so that each caller in CMAKE_BUILD_TYPE=RelWithDebInfo could be identified. Based on a quick performance test, the inline definitions are clearly beneficial; in the end, these functions are only a few machine instructions each. It also turns out that some of my replacement of these functions with simpler pointer arithmetic is causing a performance degradation. I will investigate further and revise this. It looks like we have to hit the right balance between dereferencing buf_page_t::frame and srv_page_size.

            marko Marko Mäkelä added a comment - I took another approach, initially defining the functions page_align() and page_offsets() non- inline , so that each caller in CMAKE_BUILD_TYPE=RelWithDebInfo could be identified. Based on a quick performance test, the inline definitions are clearly beneficial; in the end, these functions are only a few machine instructions each. It also turns out that some of my replacement of these functions with simpler pointer arithmetic is causing a performance degradation. I will investigate further and revise this. It looks like we have to hit the right balance between dereferencing buf_page_t::frame and srv_page_size .

            origin/10.6-MDEV-32175bis 3fa7f0e347d070afa9962c386369b5b51aedde5a 2024-10-22T16:10:10+03:00
            behaved well in RQG testing. No new problems compared to 10.6 main.
            

            mleich Matthias Leich added a comment - origin/10.6-MDEV-32175bis 3fa7f0e347d070afa9962c386369b5b51aedde5a 2024-10-22T16:10:10+03:00 behaved well in RQG testing. No new problems compared to 10.6 main.

            mleich, I think that this needs another round of testing, because the development branch had meanwhile been extended with a few more changes.

            marko Marko Mäkelä added a comment - mleich , I think that this needs another round of testing, because the development branch had meanwhile been extended with a few more changes.

            origin/10.6-MDEV-32175bis b1d113e9871a3692e3cf55e01cb2e7409ca9f8b6 2024-11-13T12:54:29+02:00
            performed well in RQG testing. No new problems

            mleich Matthias Leich added a comment - origin/10.6- MDEV-32175 bis b1d113e9871a3692e3cf55e01cb2e7409ca9f8b6 2024-11-13T12:54:29+02:00 performed well in RQG testing. No new problems

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.