Google Professional Cloud Developer Question 239
Select 3Google Cloud PlatformYou are developing a serverless application on Google Cloud using Cloud Functions. The application processes user-uploaded images stored in a Cloud Storage bucket by invoking an external API for image analysis. The application must handle high spikes in traffic, ensure low latency, and minimize costs. Which considerations should you prioritize during the development process?
- A
Implement connection pooling for the external API to reduce latency.
- B
Use a regional Cloud Storage bucket to minimize data transfer latency.
- C
Set a maximum instance limit for the Cloud Function to control costs during traffic spikes.
- D
Enable retries with exponential backoff for the external API calls to handle transient failures.
- E
Deploy the Cloud Function in multiple regions for better availability.
Show answer and explanation
Correct answers: B, C, D
Explanation
When developing serverless applications, it's important to consider latency, cost control, and fault tolerance. Using a regional Cloud Storage bucket reduces data transfer latency, while setting a maximum instance limit prevents uncontrolled scaling costs. Additionally, enabling retries with exponential backoff ensures resilience when dealing with external APIs. Connection pooling is not relevant in stateless serverless environments, and multi-region deployment is not essential for this scenario's requirements.
- A. Incorrect.
Connection pooling is not applicable to serverless environments like Cloud Functions because each function invocation runs in a stateless, isolated container. This is not a valid consideration.
- B. Correct.
Using a regional Cloud Storage bucket ensures that the data is stored close to where the Cloud Function runs, which helps reduce latency and improves performance.
- C. Correct.
Setting a maximum instance limit for the Cloud Function helps control costs during traffic spikes, as it prevents the function from scaling indefinitely and incurring high costs.
- D. Correct.
Enabling retries with exponential backoff is a best practice for handling transient failures when calling external APIs, ensuring reliability and robustness.
- E. Incorrect.
Deploying the Cloud Function in multiple regions is unnecessary in this scenario since the application primarily interacts with a regional Cloud Storage bucket and an external API, and the focus is on latency and cost.