Google Professional Cloud Database Engineer Question 165
Select 3Google Cloud PlatformYour company has a web application hosted on Google Cloud that experiences highly variable traffic patterns, with peak loads on weekends. The application uses a Cloud SQL instance for its relational database. During peak traffic, the database often becomes a bottleneck, causing increased latency for users. You are tasked with improving the database's performance to handle the peak loads while minimizing costs. Which of the following solutions should you implement?
- A
Enable Read Replicas in Cloud SQL and redirect read-heavy queries to the replicas.
- B
Upgrade the Cloud SQL instance to a larger machine type with more CPU and memory.
- C
Set up a horizontal sharding strategy by splitting the database across multiple Cloud SQL instances.
- D
Enable automatic storage increases in Cloud SQL to handle larger datasets during peak traffic.
- E
Use Cloud Spanner instead of Cloud SQL for built-in horizontal scaling and global consistency.
Show answer and explanation
Correct answers: A, B, E
Explanation
To address the performance bottlenecks, combining strategies like enabling Read Replicas (for read-heavy workloads), scaling up the machine type (for immediate performance needs), and considering Cloud Spanner (for long-term scalability) is ideal. Horizontal sharding is complex to implement quickly, and automatic storage increases do not solve the compute-related bottlenecks.
- A. Correct.
Using Read Replicas in Cloud SQL is a cost-effective way to handle read-heavy workloads by offloading read queries to replicas, which can improve performance during peak traffic.
- B. Correct.
Scaling up by upgrading to a larger machine type addresses the immediate need for more CPU and memory to handle increased traffic, making it a quick and effective solution for short-term scaling.
- C. Incorrect.
While horizontal sharding can improve scalability, it requires significant application changes and is not a native feature of Cloud SQL, making it less ideal for immediate implementation.
- D. Incorrect.
Enabling automatic storage increases in Cloud SQL only helps with storage capacity and does not directly address CPU or memory bottlenecks caused by peak traffic.
- E. Correct.
Cloud Spanner is a horizontally scalable database designed for high throughput and global consistency, making it a suitable choice for long-term scalability, though it may require significant re-architecture of the application.