[MDEV-19514] Defer change buffer merge until pages are requested Created: 2019-05-17 Updated: 2023-10-19 Resolved: 2019-10-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | 10.5.0 |
| Type: | Task | Priority: | Critical |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
For This would also simplify The change buffer format will not be changed as part of this task. That could remain part of As part of this, the counter innodb_ibuf_merge_usec will be removed from information_schema.innodb_metrics. |
| Comments |
| Comment by Thirunarayanan Balathandayuthapani [ 2019-06-03 ] | |||
|
So that, watch solves the race between page read and purge buffering. As discussed with marko, we don't | |||
| Comment by Marko Mäkelä [ 2019-07-03 ] | |||
|
I agree that we probably must keep the buffer pool watch mechanism. As part of this work, the InnoDB master thread will no longer perform change buffer merge in the background. Merges will occur when secondary index leaf pages need to be accessed due to executing SQL, purging transaction history, updating index cardinality statistics, or during shutdown with innodb_fast_shutdown=0. As part of this work, I think that we should adjust or remove the ability for innodb_force_recovery to prevent change buffer merge. After we remove the merges that would occur at I/O completion, we should have the following situation:
Note: With innodb_force_recovery=5 you could still get an inconsistent logical dump of the data (it is essentially READ UNCOMMITTED), but while reading the database, it would not corrupt the database further. | |||
| Comment by Marko Mäkelä [ 2019-09-03 ] | |||
|
Please fix the hang in the test main.tc_heuristic_recover. I can do the review after that. | |||
| Comment by Marko Mäkelä [ 2019-09-26 ] | |||
|
I pushed some suggested follow-up changes to the branch. I think that it is good to go after some testing, for both stability and performance. | |||
| Comment by Axel Schwenke [ 2019-09-27 ] | |||
|
I did a comparative benchmark of the latest commit in bb-10.5-mdev-19514 vs. the last merge of that branch with 10.5 (labeled "baseline"). As discussed with marko I used OLTP tables with a total size slightly bigger than the buffer pool. I modified the SELECTs to use the secondary index - hence reads will potentially merge buffered changes. Writes are either UPDATEs of the indexed column or DELETE or INSERT. | |||
| Comment by Marko Mäkelä [ 2019-09-30 ] | |||
|
axel, thank you! I see a trend of a slight improvement with the change buffering enabled. That could be because the change buffer merges no longer occur in the background, preserving I/O and CPU capacity for serving the immediate tasks. | |||
| Comment by Marko Mäkelä [ 2019-10-03 ] | |||
|
I have one more change for consideration: removing the ability of the purge of history to submit work to the change buffer. This also removes the buffer pool watch mechanism. This was motivated by my observation in I ported the change to 10.2 as a fix of | |||
| Comment by Axel Schwenke [ 2019-10-04 ] | |||
|
I did two more rounds of benchmarking. 1. commit 6203deb02fd Stop buffering delete (purge) operations vs. previous state of bb-10.5- 2. commit 6203deb02fd with different setting of innodb_change_buffering. Results are in attached file MDEV-19514-3.ods | |||
| Comment by Axel Schwenke [ 2019-10-08 ] | |||
|
I updated MDEV-19514-2.ods It turns out that with 20G buffer pool, 10.5 suffers the same performance drop as 10.2 when purge operations are not buffered. | |||
| Comment by Marko Mäkelä [ 2019-10-11 ] | |||
|
Based on the benchmark results, we will keep the purge buffering. If there had been no regression, we would have done it in | |||
| Comment by Matthias Leich [ 2019-10-11 ] | |||
|
| |||
| Comment by Marko Mäkelä [ 2020-10-15 ] | |||
|
MariaDB 10.5.7 will include a follow-up fix: The page read completion callback function used to invoke a function that could request the change buffer bitmap page from the buffer pool. Allocating pages from the buffer pool on read completion is a bad idea and could potentially lead to hangs. | |||
| Comment by Mark Callaghan [ 2023-02-08 ] | |||
|
Sometimes the change buffer helps a lot. One result is from the insert benchmark and the insert rate is more than 3X larger when the change buffer is enabled. | |||
| Comment by Marko Mäkelä [ 2023-02-08 ] | |||
|
mdcallag, thank you for your comment. I see that you ran your benchmark on MySQL 8.0.32 and not a version of MariaDB that would include | |||
| Comment by Mark Callaghan [ 2023-02-08 ] | |||
|
It isn't possible to show the perf impact of having the change buffer enabled and then disabled for a workload by using MariaDB 11, assuming that MariaDB 11 no longer supports the change buffer. | |||
| Comment by Marko Mäkelä [ 2023-02-09 ] | |||
|
mdcallag, there are 7 major versions of MariaDB Server (10.5 through 10.11) where not much has been changed with regard to the change buffer. It was disabled by default in | |||
| Comment by Mark Callaghan [ 2023-02-09 ] | |||
|
My workload (3 secondary indexes, uniform random access, database about 8X larger than memory) is closer to a worst case for showing how bad things can get without the change buffer. Your workload (1 secondary index, database not much larger than memory) is closer to a best case. If your workload cached all, or most, secondary index leaf pages then you will obviously not see a benefit from the change buffer. | |||
| Comment by MikaH [ 2023-03-08 ] | |||
|
Thank you Mark Callaghan for sharing your experiences related to innodb change buffering. I am playing with dataset sizes 4-8x more than available RAM. We stay on SW-level 10.5.6 until MariaDB & Codership is able to publish newer software (including wsrep) that can beat the performance and stability of the 10.5.6, and we have verified it on our own performance and stability tests. I will share our results but it takes time. | |||
| Comment by Marko Mäkelä [ 2023-03-09 ] | |||
|
mihaQ, I assume that you experienced performance regressions related to some page flushing changes in MariaDB 10.5.7. They should be mostly addressed in later releases of the 10.5 series. In the 10.6 series, as you can read in MDEV-30628, there is a regression that I am currently working on. Preliminary results related to |