[MDEV-17698] MEMORY engine performance regression Created: 2018-11-13 Updated: 2019-03-25 Resolved: 2019-03-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Memory |
| Affects Version/s: | 5.5.50, 10.0.25, 10.1.14, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.3.11, 10.4.1, 10.1.38, 5.5.63, 10.0.38, 10.2.20 |
| Type: | Bug | Priority: | Major |
| Reporter: | Axel Schwenke | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
The regression benchmarks found a regression for mixed read/write workload and MEMORY tables. The following shows the last two good and the first two bad releases for each major version of the MariaDB server. From 10.2 onward there are no good releases any more.
|
| Comments |
| Comment by Axel Schwenke [ 2018-11-13 ] | |||||||||||||||||||||||||||||||||||||
|
Narrowed it down to being range queries:
Now while it is clear that a HASH index is no much help for a range query, it still shouldn't be that much slower for no apparent reason. | |||||||||||||||||||||||||||||||||||||
| Comment by Axel Schwenke [ 2018-11-13 ] | |||||||||||||||||||||||||||||||||||||
|
perf shows decimal_cmp() as the most busy function in 5.5.50. In 5.5.49 it is completely off the radar (< 0.01% hits vs. 19.22% in 5.5.50) call graph from perf report:
| |||||||||||||||||||||||||||||||||||||
| Comment by Axel Schwenke [ 2018-11-13 ] | |||||||||||||||||||||||||||||||||||||
|
bisecting commits in the 5.5 branch finds this:
| |||||||||||||||||||||||||||||||||||||
| Comment by Axel Schwenke [ 2018-11-13 ] | |||||||||||||||||||||||||||||||||||||
|
test case in pure SQL:
On a good release the 17698_run() procedure needs ~4 seconds, on a bad one ~7 seconds. If the engine is changed to InnoDB and number of selects increased to 100000, it's ~6 seconds each. There seems to be a very small regression of ~0.1 seconds, but in any case it's much smaller. Note: firstly I used variables @j and @k in the procedure but I had to switch to declared INT variables j and k to make the effect visible. In the original sysbench range query the bounds for between are both literals and strictly non-negative. I wonder how the signedness of such constants is established? | |||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2018-11-14 ] | |||||||||||||||||||||||||||||||||||||
|
axel do you know why _oltp-memory-multi uses a mixture of signed int and unsigned int in BETWEEN? This change in procedure 17698_run:
fixes the problem. The performance degradation caused by Doing this optimization in versions 10.2 or earlier is not desirable. | |||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2018-11-14 ] | |||||||||||||||||||||||||||||||||||||
|
If I change the table t1 to use BTREE index (instead of the default HASH index):
"call 17698_run()" becomes around 100 times faster. | |||||||||||||||||||||||||||||||||||||
| Comment by Axel Schwenke [ 2018-11-15 ] | |||||||||||||||||||||||||||||||||||||
|
commit 4576942 fixes the regression in MariaDB 10.3:
| |||||||||||||||||||||||||||||||||||||
| Comment by Axel Schwenke [ 2018-11-15 ] | |||||||||||||||||||||||||||||||||||||
|
commit 7f17559 fixes the regression in MariaDB 5.5:
|