Google Professional Cloud Database Engineer Question 56
Single answerGoogle Cloud PlatformYour company runs a highly concurrent web application that uses a PostgreSQL database hosted on Google Cloud SQL. As the number of concurrent users increases, the application experiences performance degradation due to excessive database connection overhead. You are tasked with improving performance while minimizing changes to the application code. Which approach would best solve this issue?
- A
Use a session pooler service like PgBouncer to manage and reuse database connections.
- B
Upgrade the database instance to a larger machine type with more CPUs and memory.
- C
Enable high availability (HA) for the Cloud SQL instance.
- D
Increase the maximum number of connections allowed on the database.
Show answer and explanation
Correct answer: A
Explanation
Session poolers like PgBouncer are purpose-built tools that manage database connections efficiently by pooling and reusing them. This reduces the overhead of establishing new connections for every request, which is especially important in high-concurrency applications. In this scenario, using a session pooler service is the most targeted and effective solution to address the performance degradation caused by excessive connection overhead.
- A. Correct.
Using a session pooler service like PgBouncer is an effective solution to reduce connection overhead by reusing and efficiently managing database connections. This approach improves performance, especially in high-concurrency scenarios, without requiring significant changes to the application code.
- B. Incorrect.
Upgrading the database instance can improve overall performance but does not directly address the connection overhead issue caused by a high number of concurrent users. This is not the most efficient solution for the problem described.
- C. Incorrect.
Enabling high availability (HA) improves database reliability and failover capabilities but does not address the performance degradation caused by connection overhead.
- D. Incorrect.
Increasing the maximum number of connections allowed on the database could help in some cases, but it does not solve the underlying issue of connection overhead and may lead to increased resource consumption.