Google Professional Cloud Database Engineer Question 160
Select 3Google Cloud PlatformYour company is running a Cloud SQL instance with a MySQL database that supports an e-commerce platform. The platform experiences traffic spikes during sales events, leading to increased query latency and higher costs. To optimize both cost and performance, which actions should you take?
- A
Enable read replicas to offload read operations from the primary instance.
- B
Upgrade the Cloud SQL instance to a more powerful machine type with additional vCPUs and memory.
- C
Implement a caching layer using Memorystore to reduce the load on the database.
- D
Switch the database engine from MySQL to Bigtable for better scalability.
- E
Use the query insights feature in Cloud SQL to identify and optimize slow queries.
Show answer and explanation
Correct answers: A, C, E
Explanation
To optimize cost and performance for a Cloud SQL instance, you should focus on solutions that address the root causes of high query latency while minimizing additional costs. Enabling read replicas distributes the read workload, a caching layer reduces query frequency, and query insights provides actionable data to optimize performance. Simply upgrading the instance type increases costs without addressing inefficiencies, and switching to a different database engine like Bigtable is not suitable for an e-commerce platform running on MySQL.
- A. Correct.
Correct. Enabling read replicas helps distribute the read workload across multiple instances, reducing the load on the primary instance and improving performance during traffic spikes.
- B. Incorrect.
Partially correct but not optimal. While upgrading the machine type can improve performance, it increases costs significantly without addressing the root cause of high query latency.
- C. Correct.
Correct. A caching layer like Memorystore can store frequently accessed data, reducing the number of database queries and improving performance during traffic spikes.
- D. Incorrect.
Incorrect. Bigtable is not an appropriate replacement for MySQL in this scenario, as it is a NoSQL database designed for different use cases and would require significant application changes.
- E. Correct.
Correct. Using query insights allows you to identify slow and inefficient queries that can be optimized to improve performance and reduce costs.