Google Professional Cloud Developer Question 10
Select 3Google Cloud PlatformYou are designing a microservices-based architecture for a real-time e-commerce application. Each microservice will handle specific tasks such as inventory management, payment processing, and user authentication. The application needs to scale independently for each microservice and maintain low latency. Which design considerations are MOST important to ensure scalability and resilience in this architecture?
- A
Use a message broker like Pub/Sub for inter-service communication to decouple microservices.
- B
Implement a single shared database for all microservices to simplify data consistency management.
- C
Design each microservice to have its own database to ensure data isolation and independent scaling.
- D
Configure autoscaling policies for each microservice based on workload metrics such as CPU and memory usage.
- E
Use a monolithic architecture instead of microservices to reduce operational complexity.
Show answer and explanation
Correct answers: A, C, D
Explanation
To design a scalable and resilient microservices architecture, it is crucial to ensure loose coupling through mechanisms like message brokers, maintain data isolation with separate databases per service, and implement autoscaling to handle varying workloads. Avoiding shared resources and monolithic designs helps achieve the independent scalability and resilience required for a microservices-based system.
- A. Correct.
Using a message broker like Pub/Sub ensures loose coupling between microservices, enabling them to communicate asynchronously and independently, improving scalability and resilience.
- B. Incorrect.
A single shared database creates a bottleneck and tightly couples microservices, making it harder to scale them independently and potentially introducing failures.
- C. Correct.
Having separate databases for each microservice ensures data isolation, allowing each service to scale independently and reducing the risk of cascading failures.
- D. Correct.
Configuring autoscaling policies for each microservice enables dynamic resource allocation based on demand, improving scalability and cost efficiency.
- E. Incorrect.
Using a monolithic architecture contradicts the principles of microservices and limits independent scaling, making it unsuitable for a microservices-based architecture.