[MDEV-14772] Mysqldump 2-3 times slower since MariaDB upgrade to 10.1.29 Created: 2017-12-26 Updated: 2021-09-16 Resolved: 2021-09-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Scripts & Clients |
| Affects Version/s: | 10.1.29 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Stijn | Assignee: | Axel Schwenke |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 7.4.1708 (VMWare) |
||
| Attachments: |
|
| Sprint: | 10.1.32 |
| Description |
|
We upgraded 2 of our production database servers to 10.1.29 (from 10.1.15). We also updated some other yum packages at the same time. After the upgrade, the nightly mysqldump backup time has increased from around 4 hours and 15 minutes to 14 hours and 40 minutes (3 times increase) on our first database server and from 6 hours and 30 minutes to 13 hours and 40 minutes (2 times increase) on our second database server. Normal database performance (sql query times) was not visibly impacted. We use the following command for our mysqldumps:
|
| Comments |
| Comment by Elena Stepanova [ 2017-12-26 ] | ||||||||
|
stijn, could you please give any hints on the data layout: how many databases does it dump, how many tables / routines / events, what's the amount of data, and which engines are mainly used? I don't mean the exact numbers (unless you have them handy), just the general idea. | ||||||||
| Comment by Stijn [ 2017-12-26 ] | ||||||||
|
On the database servers we have 193 databases (first database server) and 171 databases (second database server). Each database has 158 tables, 2 events and 2 procedures. So about 28000-30000 tables per database server. Most tables are very small, with a few reaching 1GB, 3-4GB maximum. Biggest database is 12GB. All tables are innodb. Total data usage (/var/lib/mysql size) is 430GB and 442GB . | ||||||||
| Comment by Elena Stepanova [ 2017-12-28 ] | ||||||||
|
stijn, thanks. Also, which exact packages are you using? What does the repository file point at? Did you make any configuration changes at the same time? | ||||||||
| Comment by Stijn [ 2018-01-03 ] | ||||||||
|
We have the following packages installed of MariaDB: We upgraded from: They are pointed to http://yum.mariadb.org/10.1/centos7-amd64 . There were no configuration changes made. Only the backups are running during the night. | ||||||||
| Comment by Elena Stepanova [ 2018-01-09 ] | ||||||||
|
I couldn't reproduce the slowdown with 50 databases, 150 tables + 2 events + 2 procedures in each, 100K rows in each table, ~2G each database, ~100G total, same mysqldump command.
axel, could you please give it a try as we discussed? I used mostly the provided config file, but had to reduce InnoDB buffer pool size and InnoDB log file size, maybe you'll can use a bigger machine to keep those values intact as well. | ||||||||
| Comment by Stijn [ 2018-05-31 ] | ||||||||
|
We identified a fix for this problem. It seems the issue occurs in mysqldump after a cglib update (version 2.17-157 to version 2.17-196, the same for 2.17-222 which is the latest for CentOS 7 at the moment of testing). This also occurs in MariaDB 10.3. The mysqldump process is usually in the "D" cpu state. When checking the mysqldump process with gdb, it is stuck most of the time on a "__write_nocancel": What seems to be the problem is that the stdout buffer for writing to a file from mysqdump with cglib was decreased a lot after the update (maybe to 8KB, I have not found a way to check it on a system, only change it), causing slow dumps if the storage has high latency (nfs, ...). The fix we use is to put "stdbuf -o 10MB" before the mysqldump command. After this fix, the speed of mysqldump is back to normal. | ||||||||
| Comment by Axel Schwenke [ 2018-05-31 ] | ||||||||
|
Good catch! Can you elaborate on what kind of IO device you are dumping? I wouldn't expect much impact from STDIO buffers, except you use storage that is a) slow and b) unbuffered. An alternative to stdbuf would be using a pipe through buffer:
| ||||||||
| Comment by Stijn [ 2018-05-31 ] | ||||||||
|
We use an nfs mount for storing the mysqldumps with underlying Nimble SAN (which is pretty fast). For a sample database the mysqldump is going at about 22MB/s, but without the fix it is only 5MB/s. I can cp and mv a test database sqldump file (3500MB) to the nfs partition with about 50MB/s, so no big problems there on throughput. I think the nfs client might be waiting for more data than the standard 8KB until a small timeout before sending the data or something similar. | ||||||||
| Comment by Axel Schwenke [ 2021-09-16 ] | ||||||||
|
This affects an old version of the server (10.1). If this problem persists with an up-to-date version, please open a new ticket. |