Google Professional Cloud Database Engineer Question 57
Single answerGoogle Cloud PlatformYou are designing a highly scalable application on Google Cloud that uses a PostgreSQL database hosted on Cloud SQL. The application experiences a large number of short-lived connections, causing high connection overhead and performance degradation. How can you address this issue efficiently?
- A
Use a session pooler service like PgBouncer to manage database connections.
- B
Increase the maximum connection limit on the PostgreSQL instance.
- C
Deploy additional Cloud SQL read replicas to handle the connection load.
- D
Enable Cloud SQL Insights to monitor and optimize query performance.
Show answer and explanation
Correct answer: A
Explanation
Short-lived database connections can cause significant overhead due to the time and resources needed to establish and terminate each connection. A session pooler service, like PgBouncer, maintains a pool of reusable connections, reducing the need for constant connection setup and teardown. This approach is more efficient and directly addresses the issue, making it the best solution for this scenario.
- A. Correct.
A session pooler service like PgBouncer helps manage and reuse database connections efficiently by pooling them, reducing the overhead caused by frequent opening and closing of connections.
- B. Incorrect.
Increasing the maximum connection limit can temporarily mitigate the issue, but it does not address the root cause of connection overhead and may lead to resource exhaustion under high traffic.
- C. Incorrect.
Deploying additional read replicas improves read performance and scalability but does not solve connection overhead caused by short-lived connections.
- D. Incorrect.
Cloud SQL Insights provides query monitoring and optimization, but it does not address the issue of connection overhead directly.