'mySQL on GCP replica lag

We have a mySQL 5.7 (master-replica) running on GCP as cloud sql, since 2 days ago we started to experience lag between master and replica. seconds_behind_master reached to 3 hours and there isn't any abnormal activity I can see on the cloud sql. After some hours it got stable with zero lag but now again I see there's a lag and it keep increasing.

I don't see any error in the mysql.err log, all we get is this (on replica): [Note] InnoDB: page_cleaner: 1000ms intended loop took 5487ms. The settings might not be optimal. (flushed=1409 and evicted=0, during the time.) which we get averagely every 20 minutes. These are the primary cloud sql specs: primary summary cloudsql

is Disk throughput (MB/s) and IOPS write is ok? 400 of 400 / 25,000 of 25,000?

replica processlist This is the replica's process list, currently it's 2.5 hours behind master.

primary processlist This is the primary's process list, not much is running beside those.

Edit 1: Master_log_file - mysql-bin.064042 (replica side) Relay_Master_Log_File - mysql-bin.064000 (replica side) File - mysql-bin.064042 (master side)

Master and replica are on the same bin file by the way. but relay_master_log_file is behind? This means that replica has the latest binlog file but still didn't finish implement all on his side?

What can be the reason for such big lag? and how can it be fixed? Please help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source