Google Professional Cloud Developer Question 399
Select 2Google Cloud PlatformYou are building a serverless application on Google Cloud that connects to a Cloud SQL database. The application experiences intermittent connection issues during peak traffic. Which of the following actions should you take to resolve the issue?
- A
Use a connection pooler like the Cloud SQL Auth Proxy to manage database connections.
- B
Increase the maximum number of database connections in the Cloud SQL instance settings.
- C
Implement exponential backoff in your application’s connection retry logic.
- D
Switch to a NoSQL database like Firestore to eliminate connection limits.
- E
Enable Private IP for the Cloud SQL instance to reduce network latency.
Show answer and explanation
Correct answers: A, C
Explanation
To resolve intermittent connection issues during peak traffic, it is essential to manage and optimize database connections effectively. Using the Cloud SQL Auth Proxy provides connection pooling, which prevents connection exhaustion. Additionally, implementing exponential backoff in retry logic prevents excessive load on the database during connection failures. These approaches address the root causes of the problem without requiring significant architectural changes.
- A. Correct.
Using a connection pooler like the Cloud SQL Auth Proxy helps manage and limit the number of active database connections, which is critical for avoiding connection exhaustion during peak traffic.
- B. Incorrect.
Increasing the maximum number of database connections may provide a temporary solution but does not address the root cause of connection exhaustion. It can also lead to resource contention and degrade performance.
- C. Correct.
Exponential backoff in connection retry logic helps reduce the load caused by repeated connection attempts during peak traffic, improving overall resiliency.
- D. Incorrect.
Switching to a NoSQL database like Firestore may not be a practical solution for an application designed for relational data. This is a drastic change that requires re-architecting the application.
- E. Incorrect.
Enabling Private IP can reduce network latency but does not directly address the issue of connection exhaustion caused by high traffic.