FIFO Queues and Message Groups
~8 min read
How FIFO queues guarantee order while still allowing parallel processing across independent groups.
Every message sent to a FIFO queue must include a MessageGroupId. Messages within the SAME group are strictly delivered and processed in the exact order they were sent — SQS will not deliver message 2 of a group until message 1 has been successfully processed and deleted (or its visibility timeout has expired). Messages in DIFFERENT groups, however, can be processed in parallel, completely independently of each other's ordering.
This design lets you get both strict ordering where it matters and horizontal parallelism where it doesn't, by choosing your MessageGroupId thoughtfully — for example, using a customer ID as the group ID guarantees that one customer's events are processed in order, while different customers' events flow through the queue in parallel, not artificially serialized behind each other.
FIFO queues also provide deduplication: within a 5-minute deduplication window, a message with the same MessageDeduplicationId (or the same content, if content-based deduplication is enabled) as one already in the queue is treated as a duplicate and not delivered again — a stronger guarantee than Standard queues' best-effort behavior, useful for network retry scenarios where a producer might accidentally send the same logical message twice.
💬 Deep Dive with AI
Key points
- •Every FIFO message needs a MessageGroupId; strict order is guaranteed only within the same group
- •Different groups can be processed in parallel, avoiding unnecessary serialization
- •Choosing the right group ID granularity balances ordering guarantees against parallelism
- •FIFO queues also provide deduplication within a 5-minute window, stronger than Standard's best-effort behavior