Soru

Zorluk: Çok zorDecoupling Architectures and Event-Driven Messaging

A SaaS payroll application processes employee timesheet submissions. To ensure accurate cumulative tax and overtime calculations, all timesheet update events for any given employee must be processed in the exact order they are received. These events must be delivered to 22 independent downstream microservices: a payroll calculation engine and a compliance audit system. The application experiences traffic spikes of up to 450450 events per second. Which solution meets these requirements with the least operational overhead?

  1. A
    Publish the events to an Amazon SNS Standard topic, and subscribe 22 Amazon SQS Standard queues to the topic, with 11 queue for each microservice. Use the employee ID as the MessageGroupID attribute to group messages.
  2. B
    Publish the events to an Amazon Kinesis Data Stream, using the employee ID as the partition key. Configure each microservice to consume events from the stream using the Kinesis Client Library (KCL) running on AWS Fargate.
  3. Publish the events to an Amazon SNS FIFO topic, and subscribe 22 Amazon SQS FIFO queues to the topic, with 11 queue for each microservice. Enable the high-throughput FIFO feature on both the SNS topic and SQS queues, and use the employee ID as the Message Group ID.Cevap
  4. D
    Publish the events to an Amazon EventBridge custom event bus. Define rules to route the events to 22 Amazon SQS Standard queues, and configure the queues to use the MessageDeduplicationId attribute based on the employee ID.

Cevap

Publish the events to an Amazon SNS FIFO topic and subscribe 22 Amazon SQS FIFO queues to it, enabling high-throughput FIFO on both the topic and queues, and using the employee ID as the Message Group ID.
The correct solution leverages a native AWS serverless messaging pattern for fan-out with strict ordering. By publishing events to an Amazon SNS FIFO topic and subscribing 22 Amazon SQS FIFO queues (one for each microservice), the architecture decouples the services and guarantees exactly-once processing and FIFO delivery. The employee ID acts as the Message Group ID to ensure sequential ordering per employee. Enabling high-throughput FIFO on both the SNS topic and SQS queues allows the application to scale beyond the default limit of 300300 transactions per second to accommodate the peak traffic of 450450 events per second with minimal operational overhead.

Adım Adım Çözüm

1
Select a message fan-out service that supports ordered delivery.
Amazon SNS FIFO is selected to deliver events to multiple downstream queues while preserving strict first-in, first-out ordering.
Standard SNS topics do not guarantee message order and cannot fan out to SQS FIFO queues with order preservation.
2
Configure the logical grouping key for ordering.
Assign the employee ID as the Message Group ID on the messages published to the SNS FIFO topic.
This guarantees that all timesheet updates for a single employee are processed sequentially in the order received, while allowing concurrent processing across different employees.
3
Provision and subscribe target queues for downstream microservices.
22 SQS FIFO queues are subscribed to the SNS FIFO topic, with 11 queue dedicated to each microservice.
Dedicated queues decouple the downstream consumers and ensure each microservice receives all published events independently.
4
Configure throughput capacity to support traffic spikes.
Enable high-throughput FIFO on the SNS FIFO topic and both SQS FIFO queues.
By default, SQS FIFO queues support up to 300300 transactions per second (without batching). The expected traffic peaks at 450450 events per second, requiring high-throughput FIFO to prevent throttling.

Anahtar Kavram

Serverless event fan-out with guaranteed ordering using SNS FIFO, SQS FIFO, and High-Throughput FIFO.
Tahmini Süre:3m 0s
Bu soruyu puanla