Professional Cloud Developer Practice Questions

Google Cloud Professional Cloud Developer exam preparation

Professional Cloud Developer practice questions in English: 180 questions with explanations. The mock exam has 60 questions and 120 minutes.

Professional Cloud Developer free question 8 / 10 · Domain 4: Integrating applications with Google Cloud services

A web service on Cloud Run opens a brand-new connection to its Cloud SQL database for every incoming request and closes it afterward. Request latency is high under load. Which technique do the Cloud SQL docs describe to improve connection latency and performance?

  1. A second Cloud SQL instance, which receives the new connections so the first one stays idle for the moment
  2. A connection pool, which caches database connections so the application borrows one for a request and returns it
  3. A longer Cloud Run request timeout, which gives new connections more time to finish their setup
  4. A larger Cloud Run instance size, which opens new connections faster for the same request pattern
Show the answer and explanation

Answer: B

Why this is correct
The Manage database connections page defines a connection pool as a cache of database connections that are shared and reused to improve connection latency and performance. When the application needs a database connection, it borrows one from the pool temporarily, and when it is finished it returns the connection to the pool, where it can be reused the next time. Opening a connection for every request does the opposite: it repeats the setup work and keeps adding to the load on the database.

Why the other options are wrong
"A larger Cloud Run instance size, which opens new connections faster for the same request pattern" … The cost lies in creating and tearing down connections for every request. A bigger instance does not remove that work, whereas reuse does.
"A second Cloud SQL instance, which receives the new connections so the first one stays idle for the moment" … Adding an instance does not change how often the application creates connections, and each connection still uses client and server resources.
"A longer Cloud Run request timeout, which gives new connections more time to finish their setup" … A timeout does not lower the setup cost. The page describes pooling as the way to improve connection latency and performance.

Key point
Pool connections so that requests reuse them. Creating one per request wastes latency and resources.

Go to the Professional Cloud Developer practice app (10 free questions; purchase unlocks all questions)

See the full practice set