
Google Professional Cloud Database Engineer
Get started today
Ultimate access to all questions.
How can you address the persistent replication lag between the primary instance and read replicas in your Cloud SQL for MySQL setup after deploying a new version of a heavily used application to handle increased traffic?
How can you address the persistent replication lag between the primary instance and read replicas in your Cloud SQL for MySQL setup after deploying a new version of a heavily used application to handle increased traffic?
Explanation:
The correct approach to resolve high replication lag in Cloud SQL for MySQL involves identifying and optimizing slow running queries or setting parallel replication flags. This is because replication lag is often caused by the primary instance being unable to keep up with the write load, which can be mitigated by optimizing queries to reduce their execution time or by enabling parallel replication to allow multiple transactions to be applied to the replica simultaneously. Stopping all running queries and re-creating the replicas (Option B) is not a practical solution as it would lead to downtime and does not address the root cause. Upgrading the primary instance to a larger disk or increasing vCPU count (Option C) or adding additional memory (Option D) might help in some cases, but these are more general performance tuning steps and do not specifically address replication lag caused by slow queries or the lack of parallel replication.