Bug #114072 | Group replication slow down existing asynchronous replication | ||
---|---|---|---|
Submitted: | 20 Feb 2024 21:08 | Modified: | 8 Mar 2024 16:19 |
Reporter: | Evgeny Gelfand | Email Updates: | |
Status: | Unsupported | Impact on me: | |
Category: | MySQL Server: Group Replication | Severity: | S3 (Non-critical) |
Version: | 8.0.35-27 | OS: | Linux |
Assigned to: | MySQL Verification Team | CPU Architecture: | Any |
Tags: | group replicaiton, performace, replication |
[20 Feb 2024 21:08]
Evgeny Gelfand
[20 Feb 2024 21:20]
Evgeny Gelfand
The lag starting to accumulate once network latency increase. However the latency not affect the replication when no secondary members are up. So, to reproduce you may need to add some latency to the network between group replication members, perhaps RTT of 32 ms should be enough.
[21 Feb 2024 16:11]
Evgeny Gelfand
I've uploaded output of ps_trace_thread for the replication worker thread. Ran with following : call ps_trace_thread(<thread>,'<output file>',NULL,NULL,TRUE,TRUE,TRUE); grep COND_count_down_latch 23225.dot produce 1359 lines, an average of 38.30ms wait, i.e. 52 seconds in the trace the thread spent on the wait for COND_count_down_latch.
[21 Feb 2024 16:45]
Evgeny Gelfand
Actually I was wrong. The replication worker thread spent 58.8257 second on the COND_count_down_latch. Thank you very much for your time and efforts
[27 Feb 2024 17:05]
Evgeny Gelfand
Hello, I've set up the following configuration: GALERA 5.7 --async--> MySQL 8.0 (anonymous GTID) --async--> MySQL 8.0 Primary Group Replication with 4 nodes (including two servers located far away, FS1 and FS2). FS1 has a Round Trip Time (RTT) of 38.2ms, while FS2 has an RTT of 62.6ms. The RTT I measured using mtr on the server that acts as primary for GR and running the replica from MySQL 8.0 (anonymous GTID). The lag immediately occurs in the MySQL 8.0 (anonymous GTID) --async--> MySQL 8.0 Primary Group Replication part, but it doesn't seem to depend on the RTT. The lag accumulates when FS1 is added, but not FS2. Although the lag is more likely to occur when running multi-master, this isn't always the case. There seems to be another reason for the lag, possibly related to the network, but not just the latency. Additionally, updating slave_worker_info with master log information may be somehow related. Does MySQL need a short metadata lock before updating the table (as is the case in Sybase, for example), causing a bottleneck? Or is the table so hot that the memory page containing the table's page becomes a bottleneck? (This table isn't replicated as part of Group Replication; it's local to each host.) Here's an example of statistics for the 8.0 -> async -> Group Replication from mysqld.log (of the MySQL 8.0 anonymous GTID): Multi-threaded replica statistics for channel '57_to_8': Seconds elapsed = 120 Events assigned = 3512321 Worker queues filled over overrun level = 0 Waited due to a Worker queue full = 0 Waited due to the total size = 0 Waited at clock conflicts = 635826316600 waited (count) when Workers occupied = 0 waited when Workers occupied = 0 I'm running with 10 replica parallel workers. Thanks.
[29 Feb 2024 17:34]
MySQL Verification Team
Hi, I spent few days on this but I am unable to reproduce this. I am testing 8.0.36 only as 5.7 had its EOL last year. Server -N1-> (GR -N2-> GR+GR) configuration and I was inserting delays, garbage, noise into both N1 and N2 network and I was not able to reproduce nothing close to what you are describing. I see you are testing GALERA (not our product), are those 8.0 servers in GR our binaries or you are using some forks? Can you reproduce the problem using mysql 8.0.36 binaries made by Oracle? Thanks
[29 Feb 2024 17:41]
MySQL Verification Team
If you managed to reproduce this with 8.0.36 I would appreciate - full config of both the external master and the GR setup - how exactly did you introduce delay and by how much - what type of traffic you tested it with (I assume some sysbench is used, this is what I tested it with) Thanks
[29 Feb 2024 23:07]
Evgeny Gelfand
I found something that may support latency version. I've set binlog_transaction_dependency_tracking to be WRITESET on 8.0.35 (assign anonymous GTID to 5.7 channel) and increased replica_parallel_workers to be 256. Outcome is as following: 1. once all "far away" servers stopping the group_replication the lag disappear immediate (despite all primary or one primary and the rest is secondary). I see over 100 replica threads actively working in parallel. The waits mostly: "Waiting for preceding transaction to commit" 2. Once I am starting the "far away" the lag starting to accumulate but slowly. I see that much less replica threads actively working in parallel. The waits mostly: "waiting for handler commit". The applier threads almost all the time is idle. There is example of statistics on one of the GR nodes: Multi-threaded replica statistics for channel 'group_replication_applier': seconds elapsed = 121; events assigned = 67585; worker queues filled over overrun level = 0; waited due a Worker queue full = 0; waited due the total size = 0; waited at clock conflicts = 160508000 waited (count) when Workers occupied = 96 waited when Workers occupied = 6357000 And there is an example of statistics on the "main" GR node: Before "far away" server joins: Multi-threaded replica statistics for channel 's57': seconds elapsed = 121; events assigned = 3826689; worker queues filled over overrun level = 0; waited due a Worker queue full = 0; waited due the total size = 0; waited at clock conflicts = 3023924959100 waited (count) when Workers occupied = 628 waited when Workers occupied = 2051035200 After: Multi-threaded replica statistics for channel 's57': seconds elapsed = 120; events assigned = 5338113; worker queues filled over overrun level = 0; waited due a Worker queue full = 0; waited due the total size = 0; waited at clock conflicts = 3419144531800 waited (count) when Workers occupied = 793 waited when Workers occupied = 2388235100 You can see that the statistics almost identical. What would prevent the replica workers from work in parallel? Latency? then I would think I should see more "busy" threads and not more "idle". Thanks
[4 Mar 2024 11:07]
MySQL Verification Team
These locks are there mostly for DDL, for DMLs these are shared locks so there should be no bottlenecks. I cannot reproduce this behavior on my system but some changes in 8.0.37 should make this issue go away for you if you are able to test it. Please test and get back with results.
[5 Mar 2024 22:14]
Evgeny Gelfand
Hello, I will try to manage to use MySQL version 8.0.37. Meanwhile, I've checked the process on version 8.0.36-28. T he waits have changed: According to the trace, one thread executed 792 transactions (GTID: XXXX) (oer 10 trx per second, good). The most significant waits: sql/WaitingforaneventfromCoordinator: 7.2795 sec sql/Worker_info::jobs_cond-wait in rpl_rli_pdb.cc:2367: 7.5108 sec sql/waitingforhandlercommit: 40.3549 sec group_rpl/COND_count_down_latch-wait in plugin_utils.h:438: 45.6882 sec I believe that the wait for "COND_count_down_latch" includes the wait for "sql/waitingforhandlercommit". However, as we know, the wait is not bounded, but the work is. So maybe not. I am not sure how to improve the situation above. Above waits is after making the following changes: sync_source_info = 0 sync_relay_log = 0 sync_relay_log_info = 0 replica_parallel_workers = 80 And, Ii seems, that the growth of the lag has slowed down significantly. I would be thankful if you could direct me on how to improve/tune it, as well as how I can monitor it more efficiently. Best Regards Evgeni
[6 Mar 2024 13:08]
MySQL Verification Team
Hi, We are not responsible for the changes MySQL fork's make so since we cannot reproduce this we consider this unsupported. If you can reproduce with Oracle binary 8.0.37 please let us know. As for the tuning and monitoring, your best option is to contact our support team as that is not something that belong in the bugs system. Thank you for using MySQL Server
[6 Mar 2024 15:46]
Evgeny Gelfand
Understood thanks. Can you at least explain what it wait for: "COND_count_down_latch-wait" I can't find any documentation about it. Best Regards Evgeni
[8 Mar 2024 16:19]
Evgeny Gelfand
Please tell me when you tried to reproduce what was the replica statistics? In my case, according to statistics this about 4k tps. It may make all the difference. Thanks