Google Professional Cloud Developer Question 73
Select 3Google Cloud PlatformYou are developing a microservices-based application on Google Cloud. One of your services processes user-generated images, which are uploaded to a Cloud Storage bucket. Occasionally, the service encounters issues such as file format errors, storage unavailability, or sudden spikes in traffic. How should you design the service to gracefully handle these issues while scaling efficiently?
- A
Use Pub/Sub to decouple the image processing service from the upload process, allowing messages to queue during traffic spikes.
- B
Implement retries with exponential backoff for failed processing attempts due to transient errors.
- C
Write all error logs directly to a local file system to ensure traceability during failures.
- D
Use Cloud Functions with auto-scaling capabilities to handle sudden traffic spikes in the image processing service.
- E
Set a fixed retry count for transient errors and terminate the process immediately after reaching the limit.
Show answer and explanation
Correct answers: A, B, D
Explanation
In cloud-native systems, ensuring graceful handling of errors, disasters, and scaling events is critical for reliability and performance. Pub/Sub decouples components and manages traffic spikes, while retries with exponential backoff handle transient issues effectively. Cloud Functions' auto-scaling capabilities make it a suitable choice for handling sudden increases in workload. Logging should be centralized (e.g., with Cloud Logging) rather than relying on local storage, and fixed retry counts without exponential backoff are less robust for transient error scenarios.
- A. Correct.
Correct: Decoupling the upload process using Pub/Sub helps manage spikes in traffic by queuing tasks and ensuring the system remains responsive even under heavy load.
- B. Correct.
Correct: Implementing retries with exponential backoff is a best practice for handling transient errors like temporary storage unavailability, as it reduces the risk of overwhelming the system during retries.
- C. Incorrect.
Incorrect: Writing logs to a local file system is not recommended in cloud-native environments as it does not scale well and can lead to data loss if the instance crashes. Using Stackdriver Logging or Cloud Logging is a better alternative.
- D. Correct.
Correct: Cloud Functions can automatically scale based on traffic, making it an excellent choice for handling unpredictable workloads like spikes in image processing requests.
- E. Incorrect.
Incorrect: Setting a fixed retry count without exponential backoff can lead to repeated failures during transient issues. Exponential backoff is a more robust approach to managing transient errors.