[MDEV-26827] Make page flushing even faster Created: 2021-10-14 Updated: 2024-01-19 Resolved: 2023-03-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.5, 10.6, 10.7 |
| Fix Version/s: | 10.11.3, 11.0.2, 10.6.13, 10.8.8, 10.9.6, 10.10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
In the common case of checkpoint flushing, we can actually rely on the block->lock to protect us. The only other reason to hold buf_pool.mutex was updating the count of outstanding page writes (buf_pool.n_flush_list()). That counter is actually redundant, because we can refer to write_slots->pending_io_count(). Finally, we would remove pthread_cond_broadcast(&buf_pool.done_flush_list) from buf_page_write_complete(). Only the buf_flush_page_cleaner would call that. To wait for page writes to complete, os_aio_wait_until_no_pending_writes() may be invoked. Interface change: |
| Comments |
| Comment by Krunal Bauskar [ 2021-10-20 ] |
|
I tested this on arm and x86. |
| Comment by Marko Mäkelä [ 2021-10-20 ] |
|
krunalbauskar, thank you! Was that https://github.com/MariaDB/server/commit/c95aa553b9db56e2013f4e5db34f90eda28af995 (or with some minor fixups done today)? That branch also included |
| Comment by Marko Mäkelä [ 2021-10-22 ] |
|
In our internal testing, we are not observing any performance improvement with this change, no matter what type of configuration is used. In fact, there is a small regression. So, this one will require some more work. The other fixes ( |
| Comment by Marko Mäkelä [ 2021-11-08 ] |
|
Much of the time, on page write completion we would also invoke buf_dblwr_t::write_completed(), which will acquire and release buf_dblwr.mutex. It does not seem easy to remove, other than by removing the need for the doublewrite buffer (see MDEV-11659). That could be the next concurrency bottleneck after buf_pool.mutex. |
| Comment by Marko Mäkelä [ 2021-11-18 ] |
|
We are still observing a performance regression after rebasing this on |
| Comment by Marko Mäkelä [ 2022-01-18 ] |
|
The first part of this was pushed as The remaining 2 commits were last rebased on I am keeping this ticket "in progress" as a reminder for me that I consider this an important issue that needs to be resolved. After all, performance tests of |
| Comment by Marko Mäkelä [ 2022-02-21 ] |
|
A further idea: Why should the LRU eviction flushing actually evict each page on write completion? It would seem better to keep the write completion function as simple as possible, and to evict pages in the actual user threads that need to allocate a page. Page allocation will already have to hold buf_pool.mutex anyway, even when no page is being evicted. Furthermore, the buf_flush_page_cleaner() thread could initiate two types of page writes, like it used to do before |
| Comment by Marko Mäkelä [ 2022-10-17 ] |
|
In |
| Comment by Marko Mäkelä [ 2023-03-07 ] |
|
After I rebased this on an attempted fix of Furthermore, I realized that buf_page_t::write_complete() may not need to perform buf_pool.LRU eviction at all; starting with a fix of |