Google Professional Cloud Developer Question 8
Select 3Google Cloud PlatformYou are designing a microservices-based application on Google Cloud. Each microservice has its own database and communicates with other microservices via REST APIs. During testing, you notice that some requests fail when specific microservices are unresponsive due to high load. How should you modify the architecture to make it more resilient and ensure the application can handle such failures?
- A
Implement a circuit breaker pattern to handle failures gracefully.
- B
Use a shared database for all microservices to ensure data consistency.
- C
Introduce retries with exponential backoff for failed requests.
- D
Use a service mesh like Istio to manage service-to-service communication.
- E
Add synchronous API calls to ensure immediate consistency between microservices.
Show answer and explanation
Correct answers: A, C, D
Explanation
In a microservices architecture, resilience is critical to ensure the system remains functional even when some components fail. Implementing a circuit breaker pattern and using retries with exponential backoff are essential strategies to handle failures gracefully. Additionally, service meshes like Istio provide powerful tools to improve communication between microservices and enhance system reliability. Avoid practices like shared databases or synchronous calls, as they violate microservices principles and reduce resilience.
- A. Correct.
Implementing a circuit breaker pattern is a good practice to prevent cascading failures and handle unresponsive microservices gracefully.
- B. Incorrect.
Using a shared database goes against the principles of microservices architecture, where each microservice should own its data. It can create a single point of failure and scalability bottlenecks.
- C. Correct.
Introducing retries with exponential backoff can help handle transient failures and increase the chances of successful communication between microservices.
- D. Correct.
A service mesh like Istio provides advanced communication management, including retries, timeouts, and circuit breaking, which are essential for microservices resilience.
- E. Incorrect.
Adding synchronous API calls can make the system less resilient because it tightly couples microservices and increases the likelihood of cascading failures.