Why MySQL 5.7 replication is verry slow on my new server?

You are facing a typical issue with replication, the concurrency on the replica is less so the impact of latency for fsyncs is larger. Unless you are on ZFS, I wouldn’t disable the doublewrite buffer. Setting sync_binlog = 0 and innodb_flush_log_at_trx_commit = 0 is much safer. Why do you want to keep these to 1 on a replica?

The only way of getting more concurrency on the replica and leverage the LOGICAL_CLOCK parallel mode is to force more group commit on the primary. When you see many threads in show processlist at the “COMMIT” state on the primary, those transactions (and only those) can be applied in parallel on the replica. Try rising, carefully, binlog_group_commit_sync_delay. The value is in microseconds and is a delay for commit to add a grouping opportunity. Start at 500 (0.5ms) and rise slowly until the replica gets faster. Rising the value will affect only the new binlog files so you’ll need to wait for the replica to be executing them. Be aware that doing so adds a latency to every transactions on the primary.

1 Like