We want to tune the setting binlog_group_commit_sync_delay to increase replication performance. Our slave is currently two days behind. Does changing this setting affect the current backlog or will we see the impact after two days?
2 Answers
Existing logs are not affected. MySQL won't read and modify existing logs, it would be incredibly expensive and risky. So, yes, you'll see the benefit of this in 2 days (assuming the lag won't increase or decrease).
To me, it sounds like you are trying random optimisations to reduce the lag. If I'm correct, I recommend to investigate the reasons for slowness before making changes. Once you have an idea to make the slave faster, change a single variable, see if your hypothesis was correct, and if not undo the change.
If solving the problem is urgent, there are some things you can do to make a replica faster, like setting sync_bilog=0 and/or innodb_flush_log_at_trx_commit=0. In most cases you'd see the replica start to catch up. However, note that this is risky: if your replica crashes you will lose data. Depending on how unlucky you are, you may have to import a new backup from the source.
- 1Thanks for your answer! Sadly sync_binlog and innodb_flush_log_at_trx_commit are settings I can't change because it's an Azure managed service (cloud is always better right?). Do you have a source on the formatting of the logs with this setting?Martin– Martin2020-10-29 12:59:36 +00:00Commented Oct 29, 2020 at 12:59
- The best source is watching the logs yourself with mysqldbinlog: dev.mysql.com/doc/refman/8.0/en/mysqlbinlog.htmlFederico Razzoli– Federico Razzoli2020-10-29 13:12:49 +00:00Commented Oct 29, 2020 at 13:12
- Sadly I can't see the logs either on Azure. I'll have to create my own setup first. Thanks for your input!Martin– Martin2020-11-02 08:06:01 +00:00Commented Nov 2, 2020 at 8:06
- You can access the binary log from another server, or even from outside of Azure. With mysqlbinlog you can "translate" the binlog into a human-readable format.Federico Razzoli– Federico Razzoli2020-11-02 17:39:31 +00:00Commented Nov 2, 2020 at 17:39
Please follow link. That would be helpful for you to troubleshoot further for root cause. Could you also post output of below command to check whether binary logs downloaded or have some network latency.
show slave status
- 1The solution was not in this guide. It was fixed by increasing
binlog_group_commit_sync_delayandslave_parallel_workers. The second setting can only be changed by Microsoft in Azure Mysql. Only changingbinlog_group_commit_sync_delaywas not enough.Martin– Martin2020-11-02 08:09:23 +00:00Commented Nov 2, 2020 at 8:09
binlog_group_commit_sync_delayaffecting existing backlog and not about fixing my replication issues.