[MDEV-29343] MariaDB 10.6.x slower mysqldump etc. Created: 2022-08-20 Updated: 2023-08-07 Resolved: 2023-08-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Backup |
| Affects Version/s: | 10.6.7, 10.6.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Emilian Lanowski | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | innodb, performance | ||
| Environment: |
#server1 - CentOS 7.9, DirectAdmin 1.642, MariaDB 10.6.9 |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Hi, In April 2022 we moved from #server 1 to #server 2 (which is few times faster than #server1) and we have some troubles: 1. On #server1 there was mariadb 10.4.x and any backups/upgrades were creating really fast (30-60 seconds) 2. We uploaded backups to #server2 but installed there MariaDB 10.6.7 and.... dumping databases is taking ~60-70 minutes + after for example do command on SSH like "service mariadb restart" is making some crash recovery etc.... which is taking 1-2 hours also.... on #server1 with mariadb 10.4.x there wasn't any problems like that, I could restart mariadb anytime and there wasn't any problems... 3. Today (20.08.2022) I logged to #server1 and thinking "hmmm maybe i'll upgrade mariadb 10.4.x to 10.6.x to check if anything will happened like in #server2" - and what? If there were mariadb 10.4.x mysqldump make dumps in 30-60seconds (2100 databases).... after successfully upgrade to mariadb 10.6.x, I tried to reinstall mariadb from 10.6.9 to 10.6.9 (to check how fast is mysqldump) and that stupid mariadb 10.6.9 is doing mysqldump like 1 database every 2 seconds...so 2100 databases give us 60-70 minutes - why it's so much slower than 10.4.x? What should I do? It's terrible problem for us and I don't know how to fix that.... I'm also scared to upgrade mariadb 10.6.7 to 10.6.9 on #server2 (production server) because of recovery crashes after restart etc. Any ideas?? |
| Comments |
| Comment by Emilian Lanowski [ 2022-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Anyone?! Do you need any more details for that problem? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
how do you backups? Does "dumping" mean you're using mysqldump? Are you saying 1) mysqldump is ~60-140 times slower and 2) server restart is ~60-140 times slower? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
DirectAdmin doing backups with mysqldump if there's any upgrade/update to newer version of mariadb - but there wasn't any speed problems with MariaDB <=10.4.x (I didn't use mariadb 10.5.x so I don't know if there's such a problem too) 1. Yes... when I was writing that post backups were still in progress but I calculated it correctly... it was done after 60 minutes (#server1) .... while on the same server few minutes earlier if there was mariadb 10.4.x it took ~60 SECONDS lol (and it always took something around ~1 minute before mariadb 10.6.x) 2. Yes because there is some crash and there is recovery crash after restart mariadb (#server2) (I have many ram on that server (768gb) but innodb pool is using around 90-100gb [because I thought it's maybe because of that I gave to mysql ~300-400gb ram at first time after install], after that I changed it to 90-100gb)... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Another example: "/usr/bin/mysqlcheck -uda_admin -p`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2` --skip-write-binlog --optimize --all-in-1 --all-databases" And before MariaDB 10.6.x it was doing all my tables in 2100 databases maybe 10 minutes maximum.... now it's taking HOURS !! It's crazy.... I checked it now again...and WOW it's like 3 minutes now after start and it did only 5 databases lol.... normally it was doing after that time probably something around 500-1000 databases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I tried something now: 1. Like I mentioned - #server1 is few times slower than #server2.... now mysqldump is doing one database every 5-40 seconds, depends how many data is there... it's done after ~35-40minutes It's crazy, don't you think? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-08-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
likely this is caused by changes in InnoDB default settings that have such a dramatic effect particularly in your setup. try to compare show variables in your 10.4 and 10.6 servers. In particular, look at innodb_adaptive_hash_index, innodb_change_buffering, innodb_flush_method. But other variables that differ might matter too. You can try to set them in 10.6 the way they are in 10.4 and see if it'll make a difference. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, I got it, so here you have InnoDB variables which are different between those servers: How will you configure that to be fast as it was previously (or faster...because server 2 is really faster than server 1 as you can see under)? Servers Components
#server2 /etc/my.cnf Changed variables (I changed some variables because before that it was already the same SLOW.. so I guess they were default (probably the same as in #server1 with mariadb 10.4.x?)) LITTLE TEST 2. firstable I changed "innodb_flush_method" from "fsync" to "O_DIRECT" mysqldump took 10 minutes 10. As you can see default variables from 10.4.26 make it a LITTLE faster...but it's still not that options which make it so slow like in 10.6.x.... ANY OTHER IDEAS WHICH OPTIONS I HAVE TO CHECK? Because after upgrade from 10.4.26 to 10.6.9 it took again around 50-60 minutes.... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If you need some better/deeper tests just tell me how to do that, I'm not professional "tester" with mysql/mariadb so I need some instructions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-08-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The 10.6 default setting innodb_flush_method=O_DIRECT ( To my understanding, the two most important parameters for performance are innodb_buffer_pool_size and innodb_log_file_size. The log file size should not matter much for read workloads. Using a larger log (even several times the buffer pool should be acceptable starting with 10.5) can optimize away many page writes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
But I have innodb_buffer_pool_size and innodb_log_file_size ... check my file /etc/my.cnf: It's from #server2 (I upgraded mariadb from 10.6.7 to 10.6.9) [mysqld] I want to give more RAM to buffer_pool_size and log_file_size but... I don't know why after restart service mysqld(mariadb) it's doing something nearly 1 hour (loading buffer pools) and while that Databases are so f**king slow.... and I'm scared to improve RAM because I don't know if it will not be doing it so much longer after restart? I guess it's something like that - https://jira.mariadb.org/browse/MDEV-9930 sie 30 03:03:16 mydomain.com systemd[1]: Starting MariaDB database server... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-08-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Loading the buffer pool was single-threaded until | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-08-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So why in my case that were only 2 threads? How to set it higher? About innodb_io_capacity - So high values like 50 000 - 80 000 will not destroy fastly my disk on server? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-09-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
emil89, will the buffer pool be populated faster if you set a larger innodb_io_capacity? As far as I understand, a longevity issue with solid state devices is associated with the number of writes, not reads. If you are worried about writes, you can reduce the amount of InnoDB data page writes by making the innodb_log_file_size several times larger than innodb_buffer_pool_size. There could be a cost of longer crash recovery times. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-09-21 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@Marko Mäkelä but if I have innodb_io_capacity=500 It's then not like 48*500=24000 ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-09-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
emil89, it does not work in that way. The innodb_io_capacity mainly limits the submitted page writes in buf_flush_page_cleaner() in ‘background flushing’ or ‘idle flushing’ (see If you are concerned about the wear of the persistent storage, you should set both innodb_buffer_pool_size and innodb_log_file_size as large as possible. A rule of thumb used to be to allocate ⅘ of the available memory to the buffer pool. The log file size can be several times the buffer pool size if needed by your workload. In that way, data page writes will be deferred. This would help if many pages are being changed over and over again. When innodb_use_native_aio=ON, the parameters innodb_read_io_threads and innodb_write_io_threads do not directly control the number of any threads. They limit the amount of pending asynchronous read or write operations. Read or write completion callbacks will be invoked by a thread pool. Starting with The parameter innodb_io_capacity also happens to throttle the loading of the buffer pool at startup. Did you try increasing it to a more reasonable value? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-11-11 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-11-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'll check it tommorrow because I'll create replication slave server etc. and I'll change some my.cnf variables like innodb_io_capacity to 10 000 for test and check how it gonna be. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I don't know what you did after mariadb 10.4.x but there's many things so slow.... A) Mariadb service was stopping 20 minutes!! Earlier it was like 5 seconds.... in logs i can see: "Status: "Waiting to flush 411090 pages" so it were nearly 500 000 pages to flush while stopping mariadb... why? How to reduce or disable it? After: Again mariadb is getting up so long, I mean loading buffer pools.... it's completed after 58 minutes so I guess innodb_io_capacity didn't do anything to this, because earlier it was also 50-60 minutes.......... it getting me nervous, really.... because websites are so slow while this.... Can you help me or fix that inconveniences? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Note updates to A) not sure, seems like a different problem B) C) Could use mydumper or something to rapidly pull tables into the buffer pool. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
emil89, I see that danblack already answered your questions B) and C).
See
I think that we must consider enabling it by default after evaluating the performance impact in extensive tests of various scenarios. There is also an open ticket The motivation to delay page writes as long as possible is to reduce "write amplification": If some data pages are modified over and over again, say, only a few bytes are being modified, then by deferring the page writes we will only be writing a few bytes to ib_logfile0, instead of additionally writing the data page (innodb_page_size bytes) and computing page checksums over and over again. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2022-11-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A) Ok i'll try that My all innodb variables right now:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-05-12 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
emil89, can you please test the recently released MariaDB Server 10.6.13? It includes some performance fixes, such as There is one more fix If you use such a snapshot, please indicate the version_source_revision; it should be part of the startup message:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2023-06-06 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@marko - I can't test your fixes outside of official releases because this is my production server. I can't even update these kinds of things too often, because it upsets clients when there are frequent technical interruptions. At the moment, I still have version 10.6.10 installed... But when I update in some time to 10.6.13 or maybe even 10.6.14, then I'll let you know what the situation looks like on my end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2023-06-14 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ok, I updated 10.6.10 to 10.6.13 and I can confirm two things: 1. MariaDB stops now within few seconds What not improved: What I didn't checked: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Emilian Lanowski [ 2023-06-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I checked command "/usr/bin/mysqlcheck -uda_admin -p`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2` --skip-write-binlog --optimize --all-in-1 --all-databases" and it works faster! About backups - immediately it's slower ~5minutes per backup for me than before upgrade. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-07-07 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In Related to Do you get acceptable read performance when setting innodb_flush_method=fsync? Note that with that setting, the InnoDB buffer pool will typically be extended by the Linux file system cache. It might be better to allocate more memory to the InnoDB buffer pool. One of the purported use cases of InnoDB buffer pool resizing was to temporarily increase the buffer pool size for some heavy shifting, without having to restart the server. |