Q19 — AWS SAA-C03 Ch.14

Question 19 of 100 | ← Chapter 14

Q1019. A company is developing machine learning (ML) models on AWS. The company is developing the ML models as independent microservices. The microservices fetch approximately 1 GB of model data from Amazon S3 at startup and load the data into memory. Users access the ML models through an asynchronous API. Users can send a request or a batch of requests.The company provides the ML models to hundreds of users. The usage patterns for the models are irregular. Some models are not used for days or weeks. Other models receive batches of thousands of requests at a time.Which solution will meet these requirements?

Correct Answer: D. Direct the requests from the API into an Amazon Simple Queue Service (Amazon SQS) queue. Deploy the ML models as Amazon Elastic Container Service (Amazon ECS) services that read from the queue.Use auto scaling for Amazon ECS to scale both the cluster capacity and number of the services based on the size of the SQS queue.

Explanation

To meet the requirements for developing machine learning (ML) models as independent microservices with irregular usage patterns and the need for efficient scaling and handling of requests, the best solution is:D. Direct the requests from the API into an Amazon Simple Queue Service (Amazon SQS) queue. Deploy the ML models as Amazon Elastic Container Service (Amazon ECS) services that read from the queue. Use auto scaling for Amazon ECS to scale both the cluster capacity and number of the services based on the size of the SQS queue.Explanation:\1. Asynchronous Processing: - Using SQS allows for decoupling the request-handling process from the ML model execution. This is beneficial for handling burst traffic and irregular usage patterns, as requests can be queued and processed when capacity is available.\2. ECS for Containerized Services: - Deploying the ML models as ECS services allows for better management of resources and scaling. ECS can efficiently handle containerized applications, enabling the company to manage different models independently.\3. Auto Scaling: - Auto scaling based on the size of the SQS queue allows the system to dynamically adjust resources based on demand. When there are more requests in the queue, ECS can scale up the number of service instances to handle the load effectively, and scale down during periods of low activity.\4. Handling Irregular Usage Patterns: - Given that some models may not be used for days or weeks, this solution allows the company to deploy only the necessary resources when required, optimizing costs.Evaluation of Other Options:A. Direct the requests from the API to a Network Load Balancer (NLB): - While using Lambda functions can scale automatically, Lambda has a maximum execution time of 15 minutes, which may not be suitable for heavy ML workloads that require longer processing times. Additionally, NLB is better suited for TCP traffic, not for HTTP requests.B. Direct the requests from the API to an Application Load Balancer (ALB): - This option could work, but it may not handle the irregular usage patterns as efficiently as SQS. While it provides HTTP routing, it may not efficiently manage burst requests compared to a queue-based approach.C. Direct the requests from the API into an Amazon Simple Queue Service (Amazon SQS) queue and use AWS Lambda: - Although Lambda can scale automatically, it may not be ideal for workloads that require loading large models into memory, as Lambda has limitations related to execution time and memory size. Therefore, it may not be suitable for all ML model use cases.Conclusion:Option D provides the most effective solution for handling irregular usage patterns, efficient scaling, and asynchronous processing of requests, making it well-suited for the company's machine learning microservices architecture.