Amazon SQS Architecture
You'll learn how Amazon SQS offers two queue types and mechanisms to handle message failures.
Amazon SQS (Simple Queue Service) is AWS's fully managed message queue service. Unlike RabbitMQ which you run yourself, SQS is serverless—you don't manage servers or clustering. But understanding its architectural choices helps you design reliable asynchronous systems.
Standard vs FIFO Queues
Standard queues prioritize throughput and availability. They deliver messages at least once, sometimes duplicates, and don't guarantee order. Think of a bustling restaurant kitchen where multiple cooks grab orders—fast, but orders might get processed out of sequence.
FIFO queues guarantee exactly-once processing and strict ordering within a message group. Like a single-file line at a bank teller—slower (300 transactions/sec vs unlimited in Standard), but predictable order.
Visibility Timeout
When a consumer retrieves a message, SQS hides it from other consumers for a visibility timeout period (default 30 seconds). This prevents duplicate processing. If the consumer doesn't delete the message before timeout expires, it reappears in the queue.
Analogy: Checking out a library book. You have it exclusively for the loan period. If you don't return or renew it, it becomes available again.
Dead-Letter Queues
After a message fails processing multiple times (you configure the max receive count), SQS can automatically move it to a dead-letter queue (DLQ). This quarantines poison messages—those that consistently cause crashes—so they don't block healthy messages.
Think of it as a hospital quarantine unit for problematic patients, allowing the main emergency room to function smoothly.
Key Takeaway: Amazon SQS offers Standard queues for high throughput with at-least-once delivery, and FIFO queues for ordered exactly-once processing. Visibility timeout prevents concurrent processing, while dead-letter queues isolate repeatedly failing messages.