# MySQL 8.0 Slow Réplication

**URL:** <https://forums.percona.com/t/mysql-8-0-slow-replication/13023>\
**Category:** Other MySQL® Questions\
**Created:** [November 16, 2021, 10:44am UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023 "2021-11-16T10:44:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snake](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Snake](https://forums.percona.com/u/Snake)\
**Post date:** [November 16, 2021, 10:44am UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/1 "2021-11-16T10:44:28Z")

</div>

I have difficulty with my MySQL replication and I would like your help.

The MySLQ replication cannot to catch up the master and when the master start a huge workload the replication accumulates delay.

I add the screenshot of PMM:  
**PMM Dashboard:**  
[MySQL InnoDB Details.pdf](https://forums.percona.com/uploads/short-url/iN7HhAKZn6jEffUJrsJ7qX6cfwI.pdf) (3.6 MB)

 ![MySQL InnoDB Details](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/4/4232d82ec2f0b193b1c45ff7ce4dcae8bc6600a0.jpeg)

**Replication:**  
[Replication.pdf](https://forums.percona.com/uploads/short-url/aUjnduSqobBA7VA6m3ub79smgn8.pdf) (105.8 KB)

 ![Innodb_row_operations](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/843980e213a1579fd9d23b8de6595853088d7018.png)

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [November 16, 2021, 1:22pm UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/2 "2021-11-16T13:22:57Z")

</div>

Hi Snake, there can be a lot of factors. For starters I suggest you take a look at this article: [Can MySQL Parallel Replication Help My Slave? - Percona Database Performance Blog](https://www.percona.com/blog/2018/10/17/can-mysql-parallel-replication-help-my-slave/)

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 16, 2021, 1:24pm UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/3 "2021-11-16T13:24:59Z")

</div>

@Snake Please upload screenshots images and not PDFs

---

<div class="post-metadata">

**Author:** ![Snake](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Snake](https://forums.percona.com/u/Snake)\
**Post date:** [November 16, 2021, 2:40pm UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/4 "2021-11-16T14:40:57Z")

</div>

I have updated the post.

---

<div class="post-metadata">

**Author:** ![Snake](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Snake](https://forums.percona.com/u/Snake)\
**Post date:** [November 16, 2021, 3:09pm UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/5 "2021-11-16T15:09:08Z")

</div>

I had configured `slave_parallel_workers` on 16.

```nohighlight
+-----------------------------+---------------+ | Variable_name | Value |
+-----------------------------+---------------+
| slave_parallel_type | LOGICAL_CLOCK |
| slave_parallel_workers | 16 |
| slave_preserve_commit_order | ON |
+-----------------------------+---------------+

```

We can see that not all workers are used.

```nohighlight
mysql> SELECT performance_schema.events_transactions_summary_by_thread_by_event_name.THREAD_ID AS THREAD_ID
    -> , performance_schema.events_transactions_summary_by_thread_by_event_name.COUNT_STAR AS COUNT_STAR
    -> FROM performance_schema.events_transactions_summary_by_thread_by_event_name
    -> WHERE performance_schema.events_transactions_summary_by_thread_by_event_name.THREAD_ID IN
    -> (SELECT performance_schema.replication_applier_status_by_worker.THREAD_ID
    -> FROM performance_schema.replication_applier_status_by_worker);
+-----------+------------+
| THREAD_ID | COUNT_STAR |
+-----------+------------+
| 174597 | 1791374 |
| 174598 | 199360 |
| 174599 | 45996 |
| 174600 | 15945 |
| 174601 | 4638 |
| 174602 | 1622 |
| 174603 | 625 |
| 174604 | 256 |
| 174605 | 126 |
| 174606 | 62 |
| 174607 | 23 |
| 174608 | 8 |
| 174609 | 5 |
| 174610 | 3 |
| 174611 | 2 |
| 174612 | 2 |
+-----------+------------+

```

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [November 16, 2021, 3:18pm UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/6 "2021-11-16T15:18:52Z")

</div>

Your redo log is too small. PMM shows you this at the very top. I saw it within 3s of looking at the image.

You should not expect all replication threads to be working. LOGICAL\_CLOCK works by using a transaction dependency tree. If txn B is dependent on txn A, then B and A cannot be executed by separate threads and must be executed in A, B order.

You can also reduce disk flushing by setting innodb\_flush\_log\_at\_trx\_commit=2 and setting sync\_binlog=0. Be aware of the risks these settings carry.

---

<div class="post-metadata">

**Author:** ![Snake](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Snake](https://forums.percona.com/u/Snake)\
**Post date:** [November 23, 2021, 11:00am UTC](https://forums.percona.com/t/mysql-8-0-slow-replication/13023/7 "2021-11-23T11:00:00Z")

</div>

I increased the size of the redo log and the replication is going faster.  
Thanks for your help.
