GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 10 of 35

You support an application that uses the Cloud Storage API. You review the logs and discover multiple HTTP 503 Service Unavailable error responses from the API. Your application logs the error and does not take any further action. You want to implement Google-recommended retry logic to improve success rates. Which approach should you take?

Full set: 265 questions
Answer options
A: Retry the failures in batch after a set number of failures is logged.
B: Retry each failure at a set time interval up to a maximum number of times.
C: Retry each failure at increasing time intervals up to a maximum number of tries. Correct answer
D: Retry each failure at decreasing time intervals up to a maximum number of tries.
Correct Answer:
C. Retry each failure at increasing time intervals up to a maximum number of tries.
Explanation

The HTTP 503 Service Unavailable error indicates a transient server-side issue, meaning the request may succeed if retried later. The Google-recommended best practice for handling such errors is to implement a retry strategy with truncated exponential backoff. This approach involves retrying the failed request after a delay, with the delay increasing exponentially after each subsequent failure, up to a maximum backoff time and a maximum number of retries. This method prevents clients from overwhelming an already struggling service with rapid, repeated requests, giving it time to recover and increasing the probability of a successful subsequent attempt.

Why Incorrect

A. Retrying in batches is inefficient and can create a "thundering herd" problem, further overwhelming the service when the batch is processed.
B. Retrying at a fixed interval can lead to synchronized retries from multiple clients, which does not alleviate the load on the service effectively.
D. Decreasing the time interval between retries is an anti-pattern that would increase the request rate and worsen the load on an already unavailable service.

References

1. Google Cloud Storage Documentation, Best Practices, "Retry strategy": "For any request to Cloud Storage that fails with a retryable error code, we recommend using a retry strategy. ... We recommend using truncated exponential backoff for retries of 5xx errors...". This section explicitly recommends exponential backoff for 5xx errors, which includes 503 Service Unavailable.

2. Google Cloud API Design Guide, "Error Handling": Under the section for google.rpc.Code.UNAVAILABLE (which maps to HTTP 503), the guide states: "The client should retry with an exponential backoff. The minimum backoff should be 1s unless otherwise documented." This establishes exponential backoff as the standard, recommended client behavior for this error across Google Cloud APIs.

3. Google Cloud Architecture Framework, "Design for reliability", "Implement retries with exponential backoff": "Transient failures can be caused by temporary issues, such as network congestion or server overload. To handle these failures, implement retries with exponential backoff. This technique involves retrying a failed request with progressively longer delays between retries." This document reinforces the principle as a core reliability practice within the Google Cloud ecosystem.

Scroll to Top