SAA-C03 Question 113
Single answerA company is designing a microservices-based application on AWS. One of the microservices processes requests from users and stores metadata in an Amazon DynamoDB table. Another microservice performs data analytics by aggregating data from multiple sources and needs to maintain session state for complex computations. Which design approach should the company implement to optimize the architecture?
- A
Design the first microservice to be stateless and the second microservice to be stateful.
- B
Design both microservices to be stateless to ensure scalability.
- C
Design the first microservice to be stateful and the second microservice to be stateless.
- D
Design both microservices to be stateful to maintain data consistency.
Show answer and explanation
Correct answer: A
Explanation
Microservices should be designed based on their specific workload requirements. Stateless services are ideal for handling requests that do not require session information, as they scale more easily. Stateful services are necessary when session state or data needs to persist across multiple operations, such as in the case of complex analytics. In this scenario, the first microservice can be stateless because it uses DynamoDB for metadata storage, while the second microservice needs to be stateful to handle session state during analytics computations.
- A. Correct.
This is the correct answer because the first microservice, which processes requests and stores metadata in Amazon DynamoDB, can be stateless, as it does not need to retain session information. The second microservice, which requires session state for complex computations, should be stateful to maintain session consistency during analytics operations.
- B. Incorrect.
This is incorrect because the second microservice requires a stateful approach to manage session state for the data analytics process. Making it stateless would result in loss of session information, which is crucial for its functionality.
- C. Incorrect.
This is incorrect because the first microservice does not require session state; it can operate as a stateless service since it relies on DynamoDB to store metadata. Making it stateful would unnecessarily complicate the architecture.
- D. Incorrect.
This is incorrect because making both microservices stateful would hinder scalability and add unnecessary complexity. Only the second microservice requires state management for its analytics computations.