Soru

Zorluk: OrtaDecoupling Architectures and Event-Driven Messaging

A smart wearable device company is designing a system to process user workout telemetry events (such as activity started, heart rate milestone, activity paused, and activity completed) from fitness trackers. The events must be processed in the exact chronological sequence they are generated for each individual user workout. The backend processing application is deployed on Amazon EC2 instances. During peak hours, the backend database occasionally experiences lock contention, causing temporary processing failures. If a telemetry event fails to process, the system must retry it. If it fails 5 times, it must be isolated for analysis without blocking subsequent events for that user's workout or other users' workouts.

Which solution meets these requirements with the least operational overhead?

  1. Publish the workout events to an Amazon SQS FIFO queue, using the workout ID as the message group ID. Configure the backend EC2 instances to consume messages from the queue. Set up a dead-letter queue (DLQ) with a redrive policy on the primary SQS FIFO queue to capture failed messages after a maximum receive count of 5.Cevap
  2. B
    Publish the workout events to a standard Amazon SQS queue. Configure the backend EC2 instances to consume messages from the queue. Set up a dead-letter queue (DLQ) with a redrive policy on the primary standard SQS queue to capture failed messages after a maximum receive count of 5.
  3. C
    Ingest the workout telemetry events using an Amazon Kinesis Data Stream configured with a single shard to guarantee strict sequential ordering. Use AWS Lambda to process the stream events and write failed records to an Amazon S3 bucket for auditing.
  4. D
    Deploy an AWS Lambda function that runs continuously in a loop to poll the database for new telemetry events. Process the events, and write any failures to an Amazon SQS standard dead-letter queue after 5 retries.

Cevap

Publish the workout events to an Amazon SQS FIFO queue, using the workout ID as the message group ID. Configure the backend EC2 instances to consume messages from the queue. Set up a dead-letter queue (DLQ) with a redrive policy on the primary SQS FIFO queue to capture failed messages after a maximum receive count of 5.
The correct answer provides in-order event processing per user workout by using an Amazon SQS FIFO queue with a message group ID. Using a dead-letter queue (DLQ) with a maxReceiveCount of 5 handles failures by isolating problematic messages after multiple attempts without halting the processing of other messages.

Adım Adım Çözüm

1
Select SQS FIFO over standard queues to maintain strict message ordering.
Ensures that events for a specific workout are processed chronologically.
Standard SQS queues only provide best-effort ordering, whereas FIFO guarantees first-in, first-out delivery.
2
Use the workout ID as the message group ID.
Enables parallel processing of different workouts while maintaining ordering within each individual workout.
Messages belonging to the same message group are always processed in order relative to each other.
3
Configure a dead-letter queue (DLQ) with a maxReceiveCount of 5.
Isolates poison pill messages after 5 failed processing attempts.
Prevents unprocessable messages from blocking the rest of the queue, allowing other workloads to proceed.

Anahtar Kavram

Decoupled architecture using SQS FIFO queues with a DLQ for ordered, resilient processing.
Tahmini Süre:1m 30s
Bu soruyu puanla