Google Professional Cloud Developer Question 397
Single answerGoogle Cloud PlatformYou are developing a serverless application on Google Cloud that needs to interact with a Cloud SQL database. To manage database connections efficiently and avoid performance bottlenecks like connection exhaustion, what should you implement?
- A
Use the Cloud SQL Auth Proxy to manage connections and configure connection pooling.
- B
Open a new database connection for every request handled by your application.
- C
Use a private IP connection to Cloud SQL to avoid connection limits.
- D
Increase the maximum number of database connections in the Cloud SQL instance configuration.
Show answer and explanation
Correct answer: A
Explanation
Connection pooling is essential when managing connections to a Cloud SQL database to avoid issues like connection exhaustion. The Cloud SQL Auth Proxy not only simplifies authentication but also supports connection pooling, making it the best solution for this scenario. Opening a new connection per request or increasing connection limits are not scalable or efficient solutions.
- A. Correct.
Using the Cloud SQL Auth Proxy simplifies authentication and supports connection pooling, which helps manage database connections efficiently and avoids connection exhaustion.
- B. Incorrect.
Opening a new database connection for every request is highly inefficient and can quickly lead to connection exhaustion, especially under high traffic.
- C. Incorrect.
Using a private IP connection improves security but does not address connection pooling or database connection management.
- D. Incorrect.
Increasing the maximum number of database connections does not scale well and can lead to performance issues on the database. Proper connection pooling is a better solution.