Soru

Zorluk: Çok zorServerless and Automated Scaling Architectures for Cost Efficiency

A logistics company is designing an automated package routing application on AWS. The application receives manifest data from regional hubs, which must be processed sequentially based on arrival time to maintain an accurate package tracking ledger. The ingestion of these manifests is highly sporadic: the system experiences zero traffic for several consecutive hours, but experiences sudden spikes of up to 100 manifests within a few minutes. Each manifest takes between 12 to 14 minutes of CPU-intensive calculations to process, occasionally extending to 18 minutes for exceptionally large hubs. The solutions architect must design a highly available, serverless, and cost-optimized architecture that scales automatically and decouples manifest ingestion from processing. Which two options should the solutions architect select to satisfy these requirements?

  1. Deploy the processing application on Amazon Elastic Container Service (Amazon ECS) using AWS Fargate, and configure target tracking scaling based on the SQS queue depth.Cevap
  2. Use an Amazon Simple Queue Service (Amazon SQS) FIFO queue to buffer incoming manifest data and maintain strict message ordering.Cevap
  3. C
    Deploy the processing application on AWS Lambda, configuring the functions to be triggered directly by the upload events.
  4. D
    Use an Amazon Simple Queue Service (Amazon SQS) Standard queue to decouple the components, and implement consumer-side logic to re-order the processed manifests.

Cevap

To design a cost-effective, ordered, and auto-scaling serverless architecture, the solutions architect should use an Amazon SQS FIFO queue to preserve manifest sequence, and deploy the processing workload on Amazon ECS with AWS Fargate, scaling the task count based on the SQS queue depth.
Using an Amazon SQS FIFO queue ensures that manifest data is processed in the exact order of arrival, preserving the integrity of the ledger. Deploying the workload on Amazon ECS with AWS Fargate provides a serverless compute platform that can run tasks indefinitely without the 15-minute timeout constraint of AWS Lambda. By using target tracking scaling based on the SQS queue depth, the application automatically provisions containers to handle traffic spikes and terminates all tasks when no messages remain, minimizing idle costs.

Adım Adım Çözüm

1
Determine the appropriate messaging queue type to meet the ordering and decoupling requirements.
Select Amazon SQS FIFO queues.
The ledger requires messages to be processed sequentially based on arrival time. Amazon SQS FIFO queues guarantee first-in, first-out delivery and exactly-once processing.
2
Evaluate the compute options based on the execution duration, compute requirements, and cost-efficiency.
Select Amazon ECS with AWS Fargate instead of AWS Lambda.
The processing tasks run for 12 to 18 minutes. AWS Lambda has a hard timeout limit of 15 minutes, making it unsuitable. AWS Fargate has no such timeout, scales container instances dynamically, and is more cost-efficient for long-running compute-intensive tasks.
3
Configure the scaling mechanism for the compute layer to minimize idle costs.
Implement target tracking scaling based on queue depth.
By scaling the ECS Fargate tasks based on the number of visible messages in the SQS queue, the system can scale down to zero when the queue is empty, eliminating idle compute costs, and scale up rapidly to handle traffic spikes.

Anahtar Kavram

Serverless container orchestration and ordered message queue decoupling for long-running batch processing workloads.
Tahmini Süre:3m 0s
Bu soruyu puanla