Lesson 1 of 3 Amazon SQS

Choosing Between Standard and FIFO Queues

This lesson explains how to choose between the two Amazon SQS queue types, which trade throughput against ordering and delivery guarantees.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish standard and FIFO queues by throughput, ordering and duplicate delivery.
  • Explain how message group IDs and deduplication IDs control ordering and remove duplicates.
  • Describe the message size limit and how larger payloads are handled.
  • Explain how message attributes and batching are used.

Comparing the queue types

Amazon SQS offers two queue types, and the choice is made when the queue is created.

A standard queue supports a nearly unlimited number of requests per second. To achieve this, it stores copies of each message on several servers, and occasionally a message is delivered more than once or out of order. Consumers of a standard queue must therefore be idempotent and must not depend on order. Most decoupling and buffering workloads tolerate this.

A FIFO queue preserves order and removes duplicates. Every message carries a message group ID, and messages with the same group ID are delivered strictly in the order they were sent, one batch at a time; messages in different groups are processed in parallel. Using the customer or order ID as the group ID therefore keeps each customer's events in order while still allowing concurrency. A deduplication ID, or content-based deduplication, discards a repeated message sent within five minutes. FIFO queues have lower throughput limits, which high-throughput mode raises, and their names must end in .fifo. The following table summarises the differences.

Standard
ThroughputNearly unlimited
DeliveryAt least once; occasional duplicates
OrderingBest effort
NameAny
FIFO
Throughput300 API calls per second per action, or 3,000 messages per second with batches of 10 (more in high-throughput mode)
DeliveryExactly-once processing: duplicate sends within 5 minutes are removed, but consumers should still be idempotent
OrderingStrict, within each message group
NameMust end in .fifo

Consumers of a standard queue must be idempotent, because duplicates can occur.

Sort into groups

Standard or FIFO?

Exam skills 1.1.1 · 4.3.3

Choose the queue type from the ordering, duplicate and throughput needs.

Log in to try this activity Interactive activities are free with an account.

Message groups and deduplication

SQS FIFO queues preserve order and remove duplicates through two message attributes. The following list describes them.

  • Message group ID: order is kept within a group, and different groups are processed in parallel. One group per customer gives both ordering and throughput; a single group for the whole queue serialises everything.
  • Deduplication: duplicates are removed within a 5-minute window, using a MessageDeduplicationId or content-based deduplication.

Example. Ordering per customer, with a deduplication ID:

sqs.send_message(
    QueueUrl="https://sqs.eu-west-1.amazonaws.com/111122223333/orders.fifo",
    MessageBody=json.dumps({"orderId": "9017", "event": "PAID"}),
    MessageGroupId="customer-42",
    MessageDeduplicationId="9017-PAID",
)

The following diagram shows how message groups and deduplication behave in the example above.

Message groups in an SQS FIFO queue. Messages for customer-42 are delivered in order to one consumer while messages for customer-7 are processed in parallel by another. A message sent again with the same deduplication ID within five minutes is dropped. Putting every message in one group would serialise the whole queue.
Ordering applies within each message group, so one group per customer keeps each customer's events in order while different customers are processed in parallel.

Message size, attributes and batching

SQS imposes limits on message size and provides attributes and batching. The following list describes these features.

  • Size: the maximum was 256 KB for many years, the figure most exam questions use; AWS raised it to 1 MiB in 2025. For larger payloads, the SQS Extended Client Library stores the body in S3 and sends a pointer.
  • Message attributes: typed metadata used for routing or filtering.
  • Batching: SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch handle up to 10 messages per call, reducing cost.
Scenario questions

Tune a queue

Exam skills 4.3.3

Practise fixing FIFO throughput, large messages and API cost.

Log in to try this activity Interactive activities are free with an account.
Worked example

Ordering where it matters

A bank's account events (deposit, withdrawal) must be processed in order for each account, but accounts are independent. It processes 5,000 events per second.

DesignOutcome
Standard queueHigh throughput but no ordering: a withdrawal could be processed before the deposit that funds it
FIFO queue with one message groupStrict global order, but only one consumer can work at a time: too slow
FIFO queue with MessageGroupId = accountId and high throughput modeOrder per account, parallel processing across accounts

The third design gives exactly the ordering the business needs and no more. A deduplication ID (the event ID) means a retried send within five minutes does not create a duplicate event.

Check yourself

Order events must be processed in order for each customer, while different customers are processed in parallel. How?

Show answer

Use a FIFO queue with the customer ID as the message group ID. Order is kept within each group, and different groups are processed at the same time.

Exam Tips

Remember for the exam

  • When order is required per customer or order, use a FIFO queue with that key as the message group ID.
  • Consumers of a standard queue must handle duplicate messages.
  • If FIFO throughput is limited because every message shares one group ID, use more group IDs.
  • To reduce SQS API cost, batch sends, receives and deletes (up to 10 messages per call).
  • Messages larger than the size limit call for the Extended Client Library with S3.