"A queue always keeps messages in order." Not a standard queue in Amazon SQS. It tries, but under load messages can arrive out of order, and now and then the same message arrives twice. If order or duplicates matter, you either design for them or use a FIFO queue.
Standard queues
Standard is the default queue type, and the right one most of the time:
- Nearly unlimited throughput: a very high number of API calls per second.
- At-least-once delivery: every message is delivered, but occasionally more than once.
- Best-effort ordering: usually in order, not guaranteed.
The fix for duplicates is to make processing idempotent: handling the same message twice must do no harm. A common pattern is to give each message a business ID (an order number, a request ID) and record it when you finish; if the ID is already recorded, skip the work. "Charge the card" is dangerous to repeat; "mark order 123 as paid" is safe.
FIFO queues
FIFO means first in, first out. Its name must end in .fifo, and it adds two guarantees:
- Strict order within each message group.
- Exactly-once processing: SQS removes duplicates sent within a five-minute deduplication interval, using a deduplication ID you supply or a hash of the message body (content-based deduplication).
Every message sent to a FIFO queue needs a message group ID. Inside one group, messages are delivered in order and one batch at a time. Different groups are independent, so they can be processed in parallel. With Lambda, the number of active groups also limits how many invocations run at once.
The price: throughput
Order costs speed. Without batching, a FIFO queue supports 300 API calls per second per action; with batches of ten, up to 3,000 messages per second. High throughput mode raises those limits much further, with the exact numbers depending on the Region, so check the current SQS quotas page before you size a system on it.
A common mistake is choosing FIFO "to be safe" for work that does not need order, like resizing images. You give up throughput and parallelism for nothing. Another is putting everything in one message group: then the whole queue is processed strictly one batch at a time.
Standard queues also support fair queues (added in 2025): when you set a message group ID on a standard queue, SQS keeps one noisy tenant from delaying everyone else, without FIFO's ordering limits.
Where AI fits
Chat with an AI assistant is a natural fit for FIFO. If a user sends "Book a table" and then "Actually, make it 8 pm", the model must see them in that order. Use the conversation ID as the message group ID: each conversation is processed in order, while thousands of different conversations still run side by side. Combine it with deduplication so a retried send does not produce two answers.
Quick recap
- Standard: fast and nearly unlimited, but at least once and best-effort order. Make workers idempotent.
- FIFO: strict order per message group and exactly-once processing, with lower throughput.
- Use many message groups, like one per conversation, to keep parallelism.