AWS Builder Center

Amazon SQS FIFO vs Standard Queues: When Does Message Ordering Matter?

Differences between SQS FIFO and Standard Queues

Message queues are an important part of building scalable and loosely coupled applications.
Amazon Simple Queue Service (SQS) provides a managed way for applications to communicate asynchronously.
However, when creating an SQS queue, developers must decide between Standard and FIFO queues.
This decision affects message ordering, throughput, and duplicate processing.

1. Understanding Standard Queues

Standard queues are designed for high throughput and scalability.
They provide at-least-once message delivery.
This means a message can occasionally be delivered more than once.
They also provide best-effort ordering rather than strict ordering.
For example, an application might send:
Order Created → Payment Confirmed → Order Shipped
However, consumers should not assume that messages will always be received in that exact order.
Standard queues are useful when:
  • High throughput is important.
  • Occasional duplicate deliveries can be handled.
  • Strict ordering is unnecessary.
  • Applications can process messages independently.

2. Understanding FIFO Queues

FIFO stands for First-In, First-Out.
FIFO queues preserve message ordering within a message group.
For example, imagine processing transactions for an individual customer.
Customer A:
Transaction 1 → Transaction 2 → Transaction 3
The application may depend on these operations being processed in sequence.
A FIFO queue allows messages with the same MessageGroupId to be processed in order.
Different message groups can still be processed concurrently.
This is useful when an application needs ordering without unnecessarily serializing all its traffic.

3. What Is Deduplication?

Another important FIFO feature is message deduplication.
Suppose an application accidentally sends the same transaction message twice.
Without appropriate protection, the consumer might process the transaction more than once.
FIFO queues support deduplication using:
  • Content-based deduplication.
  • Explicit MessageDeduplicationId values.
Deduplication helps prevent duplicate messages from being accepted within the applicable deduplication interval.
However, this does not mean your application can ignore idempotency.
Consumers should still be designed to handle repeated processing safely.

4. Standard vs FIFO

Feature
Standard
FIFO
Message ordering
Best effort
Guaranteed within a message group
Delivery
At least once
Exactly-once processing features within documented deduplication limits
Deduplication
Not built-in in the same way
Supported
Throughput
Very high
Has configured throughput limits
Message groups
No
Yes
FIFO's exactly-once terminology should not be confused with a guarantee that every downstream database operation or external side effect happens exactly once.

5. Real-World Examples

Example A: Image processing
An application receives thousands of independent image uploads.
Each image can be processed separately.
A Standard queue is generally suitable because strict ordering is unnecessary.
Example B: Banking transactions
A system processes sequential account operations where transaction order matters.
A FIFO queue with appropriate message groups is a better fit.
The consumer should also use idempotent transaction handling.
Example C: Order processing
An e-commerce application needs to process updates for individual orders in sequence.
Using a message group per order can help preserve the required order while allowing different orders to be processed concurrently.

6. Choosing the Right Queue

Before creating an SQS queue, ask yourself:
  1. Does message order matter?
  1. Can messages be processed independently?
  1. Is duplicate processing acceptable?
  1. What throughput does the application require?
  1. Can the consumer safely retry failed messages?
These questions help determine which queue type is appropriate.

Conclusion

Standard queues are useful for highly scalable asynchronous workloads where strict ordering is unnecessary.
FIFO queues are useful when ordering and deduplication are important.
The best choice depends on the application's processing requirements, not simply which queue offers more features.
Have you used FIFO queues in a real application? What was the biggest challenge when implementing message ordering?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article