[MDEV-15914] performance regression for mass update Created: 2018-04-18 Updated: 2020-09-16 Resolved: 2018-04-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.3.3 |
| Fix Version/s: | 10.3.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Axel Schwenke | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Updating a column in all rows of an InnoDB table has become slower in MariaDB 10.3, compared to 10.2. Test case
The final UPDATE touches 1 mio rows. There is no index involved. The update can be done in place. In 10.2.14 the updates takes 2 seconds on average, in 10.3.5 it takes 3 seconds on average. More numbers in related |
| Comments |
| Comment by Marko Mäkelä [ 2018-04-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To rule out the effect of
With this, a non-debug build of 10.2 shows me the following when running
For 10.3 with the above revision merged, I get the following:
The total test time is much longer (50.8 instead of 17.7 seconds; 33.1 seconds increase), divided as follows:
The increased restart time is expected due to the purge ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2018-04-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
While you are at it, maybe you should also time DELETE and drop table performance. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Simpler test (no restart; purge disabled):
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The above results were obtained when compiling with clang-6.0. At least in one function, clang emitted a long sequence of jmpq functions jumping forward in the function, so the code did not look optimal. Using gcc 8.0.1 the performance difference is smaller:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Here is a more suitable test for running sudo perf top while the UPDATE are executing:
The results (CC=gcc-8 cmake -DPLUGIN_PERFSCHEMA:STRING=NO, with skip_innodb_adaptive_hash_index):
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I tried various different optimizations until I accidentally found the cause of the regression: In MariaDB 10.3.3 I replaced the high-level redo log record MLOG_UNDO_INSERT with the low-level records MLOG_2BYTES and MLOG_WRITE_STRING. It turns out that the small amount of added redo log volume (4 more bytes of payload and writing the page identifier twice instead of once) accounted for all of the increased execution time on my system. Edit: In | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
bb-10.3-marko contains many small changes that were motivated by checking sudo perf top while running the test. What fixed the performance for me was reverting a slight redo log volume increase for undo logging. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-04-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pushed to 10.3, along with a merge of |