Google Professional Cloud Developer Question 443
Select 3Google Cloud PlatformYou are building a Google Cloud application that processes large volumes of incoming data via a REST API. To improve efficiency and reduce the number of network calls, you decide to implement request batching. Which of the following are best practices for batching requests in this scenario?
- A
Ensure the batch size is optimized to balance processing efficiency and memory limits.
- B
Implement retry logic for individual requests within the batch in case of partial failures.
- C
Always include the maximum possible number of requests in each batch to minimize API calls.
- D
Use exponential backoff for retrying the entire batch in case of failures.
- E
Structure the batch request payload to conform to the API's specific batching format.
Show answer and explanation
Correct answers: A, B, E
Explanation
When implementing request batching, it's important to balance efficiency and reliability. Optimizing batch size and retrying failed requests individually ensures better performance and resilience. Additionally, conforming to the API's specific batching format is necessary for proper functionality. Avoid excessive batching that could lead to failures and prefer handling partial errors rather than retrying entire batches.
- A. Correct.
Correct: Optimizing batch size is important to prevent memory issues and ensure efficient processing while not overwhelming the API.
- B. Correct.
Correct: Partial failures can occur in a batch, and retrying individual failed requests ensures data integrity and success for as many requests as possible.
- C. Incorrect.
Incorrect: Including the maximum possible number of requests in every batch could lead to exceeding memory or API limits, causing failures.
- D. Incorrect.
Incorrect: Exponential backoff is a recommended practice for retrying API calls, but applying it to retry the entire batch might not be optimal for partial failures.
- E. Correct.
Correct: Many APIs have specific formats for batch payloads, and adhering to these formats is critical for successful request processing.