[MDEV-14339] Different Galera performance behavior regarding to flushing between MySQL and MariaDB Created: 2017-11-09 Updated: 2020-08-25 Resolved: 2019-05-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera, Replication, Storage Engine - InnoDB |
| Affects Version/s: | 10.1.17, 10.1, 10.2.8, 10.2.13 |
| Fix Version/s: | 10.4.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Hartmut Holzgraefe | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Duplicate | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
When doing sysbench tests against standalone mysqld vs. single node Galera instance vs. two node cluster performance differs between MySQL and MariaDB setups. With both MySQL and MariaDB standaline non-Galera nodes show best transactions per second throughput when not having to do any commit time fsync, as expected. Meaning that things are fast with innodb_flush_at_trx_commit != 1 and log_bin disabled or sync_binlog=OFF A single node MySQL Galera setup shows almost the same numbers, is fast in the same config combinations. A MariaDB Galera 10.x cluster, with 0 <= x <= 2 at least, shows a slightly different behavior though. Here only the combination "innodb_flush_at_trx_commit != 1, log_bin enabled, sync_binlog=OFF" is almost as fast as a standalone non-galera-enabled instance with the same "no fsync" settings. When disabling log_bin transactions per second go down quite a bit, to similar values as if innodb_flush_at_trx_commit was actually enabled. I first suspected that group_commit might play a role, but Binlog_commits and Binlog_group_commits counters were always showing equal values in SHOW STATUS output, so this can be ruled out. When running sysbench against a 2 node cluster performance differences were not as massive as in the single node setup, which was to be expected, but still visible. So while turning off innodb_flush_at_trx_commit; and sync_binlog if log_bin is enabled, is usually considered safe in a cluster (if the hardware setup is redundant enough, e.g. simultaneous power failure on all nodes can be ruled out), and to improve performance/throughput a little bit, it turns out that with MariaDB the performance improvement is only visible if binlog writing is enabled, which is at least counter-intuitive. |
| Comments |
| Comment by Hartmut Holzgraefe [ 2017-11-09 ] | ||||||||||||||||||||||||||||||||||||||||
|
Actual benchmark numbers to follow in a bit, I unfortunately created a bit of a mess with my recorded files that I need to sort out first. Or maybe I'll even actually re-run all tests to be sure that there are no mixups left ... | ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-02-08 ] | ||||||||||||||||||||||||||||||||||||||||
|
Finally, numbers. Unfortunately I ran into a lot of unrelated problems when trying to reproduce this reliably. I'm still not always getting clear numbers like listed below in all cases, but the general trend is now clear: I'm comparing MariaDB 10.2.9 and MySQL 5.7.18 here as these were the current versions when I originally started testing. Numbers are produced by setting up three different server layouts:
Numbers are generated with Sysbench 1.0, running on the second node
Sysbench runs against variations of:
This leads to 3*2*2*2*2 = 48 variants tested for each server version. Full data for MySQL 5.7.18, MariaDB 10.2.9 and MariaDB 10.1.17 will be attached, for now lets look at the HDD values for MySQL 5.7 and MariaDB 10.2 only. Rows are ordered by transactions per second (tps) result from sysbench, so order may differ between mysqld versions tested. First testing standalone:
We see that results are roughly similar, things are substantially faster when no syncs happen (trx=0 and syn=0 or log=0 so that syn doesn't matter) Now looking at single node Galera setup:
For MySQL (right column) the "no syncing" results are similar to "no galera", but when syncs come into play things get much slower than in standalone. On the MariaDB side on the other hand the number for "log-bin, but no syncs on commit" is even a bit higher than without galera, but the other two "no sync" cases get much slower (though still about twice as fast as with sync). Similar effects can be seen on a dual node cluster:
| ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-02-08 ] | ||||||||||||||||||||||||||||||||||||||||
|
For each server versions "sysbench run" was executed twice after "sysbench prepare", "bench1" and "bench2" files contain results for first and second run. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-02-08 ] | ||||||||||||||||||||||||||||||||||||||||
|
Galera versions:
| ||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-03-08 ] | ||||||||||||||||||||||||||||||||||||||||
|
The Ali ticket aims at closely related issue. | ||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-03-08 ] | ||||||||||||||||||||||||||||||||||||||||
|
Non-galera specific case | ||||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2018-11-09 ] | ||||||||||||||||||||||||||||||||||||||||
|
I checked the up-to-date 10.1.37 sources code trying to find any apparent suspect for performance degradation when the single galera node changes from ---log-bin=ON to OFF as well as tried verifying benchmarks results. I could not find any apparent glitch in the sources. While the binlog grouping obviously can't work in --log-bin=OFF
In my benchmarking of 1 node the two numbers are
I used mysqlslap with 10 connections loading the server mostly (over 90%) with write operations. I did not run it long time, being content with 60 seconds thinking that PS. I am not whether it anyhow mattered in original benchmarking, in my case I spotted that
which made few of my application's selects run at normal speed. I think it makes sense to measure the figures once again using the original method, In case it will still be reproduced, I will need to know exact configuration (my.cnf, the single node start script - I use {{ mtr galera.test --start }} for that) as well as the benchmarking | ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-11-28 ] | ||||||||||||||||||||||||||||||||||||||||
|
Could not reproduce it with the backup of my original test setup (may not have recovered the actual final backup of it). With manual testing I now see it again though. Platform: Ubuntu 18.04.1, datadir on SSD Versions tried: 10.2.8, 10.2.19, 10.3.11 Basic single node configuration:
With just extra
using defaults for sync-binlog and innodb-flush-log-at-trx-commit I get about 90tps on all three versions. With extra
I see a speedup to about 1000tps. When I disable the binlog:
I get about 250-300tps. For running sysbench I use
I'm going to attach the sysbench output for 10.3.11 | ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-11-28 ] | ||||||||||||||||||||||||||||||||||||||||
|
mariadb-10.3.11-1.log – log-bin enabled, sync/flush off, ~1000tps | ||||||||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2018-11-28 ] | ||||||||||||||||||||||||||||||||||||||||
| Comment by Ranjan Ghosh [ 2018-12-02 ] | ||||||||||||||||||||||||||||||||||||||||
|
Hm. I cannot see any difference. I get 3000 tps consistently with the script mentioned above. BTW: Isn't sync_binlog=0 the default anyway? | ||||||||||||||||||||||||||||||||||||||||
| Comment by Seppo Jaakola [ 2019-05-23 ] | ||||||||||||||||||||||||||||||||||||||||
|
The fix for |